errortext += 'Stack trace:\n';
// Indent stack trace.
- errortext += exc.stack.split('\n').map(function(line) {
- return ' ' + line;
- }).join('\n');
+ errortext += exc.stack.split('\n').map(line => ' ' + line).join('\n');
let scroll = new Gtk.ScrolledWindow({ vexpand: true });
let buffer = new Gtk.TextBuffer({ text: errortext });
this._shellProxy = new GnomeShellProxy(Gio.DBus.session, 'org.gnome.Shell', '/org/gnome/Shell');
- this._shellProxy.connectSignal('ExtensionStatusChanged', Lang.bind(this, function(proxy, senderName, [uuid, state, error]) {
+ this._shellProxy.connectSignal('ExtensionStatusChanged', (proxy, senderName, [uuid, state, error]) => {
if (ExtensionUtils.extensions[uuid] !== undefined)
this._scanExtensions();
- }));
+ });
this._window.show_all();
},
let row = new ExtensionRow(extension.uuid);
row.prefsButton.visible = this._extensionAvailable(row.uuid);
- row.prefsButton.connect('clicked', Lang.bind(this,
- function() {
- this._selectExtension(row.uuid);
- }));
+ row.prefsButton.connect('clicked', () => {
+ this._selectExtension(row.uuid);
+ });
row.show_all();
this._extensionSelector.add(row);
this.uuid = uuid;
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell' });
- this._settings.connect('changed::enabled-extensions', Lang.bind(this,
- function() {
- this._switch.state = this._isEnabled();
- }));
+ this._settings.connect('changed::enabled-extensions', () => {
+ this._switch.state = this._isEnabled();
+ });
this._settings.connect('changed::disable-extension-version-validation',
- Lang.bind(this, function() {
+ () => {
this._switch.sensitive = this._canEnable();
- }));
+ });
this._settings.connect('changed::disable-user-extensions',
- Lang.bind(this, function() {
+ () => {
this._switch.sensitive = this._canEnable();
- }));
+ });
this._buildUI();
},
this._switch = new Gtk.Switch({ valign: Gtk.Align.CENTER,
sensitive: this._canEnable(),
state: this._isEnabled() });
- this._switch.connect('notify::active', Lang.bind(this,
- function() {
- if (this._switch.active)
- this._enable();
- else
- this._disable();
- }));
- this._switch.connect('state-set', function() { return true; });
+ this._switch.connect('notify::active', () => {
+ if (this._switch.active)
+ this._enable();
+ else
+ this._disable();
+ });
+ this._switch.connect('state-set', () => true);
hbox.add(this._switch);
},
this._userVerifier.connect('ovirt-user-authenticated', Lang.bind(this, this._onOVirtUserAuthenticated));
this.smartcardDetected = this._userVerifier.smartcardDetected;
- this.connect('next', Lang.bind(this, function() {
- this.updateSensitivity(false);
- this.startSpinning();
- if (this._queryingService) {
- this._userVerifier.answerQuery(this._queryingService, this._entry.text);
- } else {
- this._preemptiveAnswer = this._entry.text;
- }
- }));
+ this.connect('next', () => {
+ this.updateSensitivity(false);
+ this.startSpinning();
+ if (this._queryingService) {
+ this._userVerifier.answerQuery(this._queryingService, this._entry.text);
+ } else {
+ this._preemptiveAnswer = this._entry.text;
+ }
+ });
this.actor = new St.BoxLayout({ style_class: 'login-dialog-prompt-layout',
vertical: true });
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
- this.actor.connect('key-press-event',
- Lang.bind(this, function(actor, event) {
- if (event.get_key_symbol() == Clutter.KEY_Escape) {
- this.cancel();
- }
- return Clutter.EVENT_PROPAGATE;
- }));
+ this.actor.connect('key-press-event', (actor, event) => {
+ if (event.get_key_symbol() == Clutter.KEY_Escape)
+ this.cancel();
+ return Clutter.EVENT_PROPAGATE;
+ });
this._userWell = new St.Bin({ x_fill: true,
x_align: St.Align.START });
reactive: true,
can_focus: true,
label: _("Cancel") });
- this.cancelButton.connect('clicked',
- Lang.bind(this, function() {
- this.cancel();
- }));
+ this.cancelButton.connect('clicked', () => { this.cancel(); });
this._buttonBox.add(this.cancelButton,
{ expand: false,
x_fill: false,
reactive: true,
can_focus: true,
label: _("Next") });
- this.nextButton.connect('clicked',
- Lang.bind(this, function() {
- this.emit('next');
- }));
+ this.nextButton.connect('clicked', () => { this.emit('next'); });
this.nextButton.add_style_pseudo_class('default');
this._buttonBox.add(this.nextButton,
{ expand: false,
this._updateNextButtonSensitivity(this._entry.text.length > 0);
- this._entry.clutter_text.connect('text-changed',
- Lang.bind(this, function() {
- if (!this._userVerifier.hasPendingMessages)
- this._fadeOutMessage();
+ this._entry.clutter_text.connect('text-changed', () => {
+ if (!this._userVerifier.hasPendingMessages)
+ this._fadeOutMessage();
- this._updateNextButtonSensitivity(this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING);
- }));
- this._entry.clutter_text.connect('activate', Lang.bind(this, function() {
+ this._updateNextButtonSensitivity(this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING);
+ });
+ this._entry.clutter_text.connect('activate', () => {
if (this.nextButton.reactive)
this.emit('next');
- }));
+ });
},
_onAskQuestion(verifier, serviceName, question, passwordChar) {
return;
}
- let signalId = this._userVerifier.connect('no-more-messages',
- Lang.bind(this, function() {
- this._userVerifier.disconnect(signalId);
- this._userVerifier.clear();
- onComplete();
- }));
+ let signalId = this._userVerifier.connect('no-more-messages', () => {
+ this._userVerifier.disconnect(signalId);
+ this._userVerifier.clear();
+ onComplete();
+ });
},
cancel() {
Extends: Task,
_init() {
- this.parent(this, function () {
- return this;
- });
+ this.parent(this, () => this);
this._acquisitions = 1;
},
return;
this.acquire();
- let signalId = hold.connect('release', Lang.bind(this, function() {
- hold.disconnect(signalId);
- this.release();
- }));
+ let signalId = hold.connect('release', () => {
+ hold.disconnect(signalId);
+ this.release();
+ });
},
release() {
if (hold && hold.isAcquired()) {
// This task is inhibiting the batch. Wait on it
// before processing the next one.
- let signalId = hold.connect('release',
- Lang.bind(this, function() {
- hold.disconnect(signalId);
- this.nextTask();
- }));
+ let signalId = hold.connect('release', () => {
+ hold.disconnect(signalId);
+ this.nextTask();
+ });
return;
} else {
// This task finished, process the next one
let startTime = GLib.get_monotonic_time();
- this._timedLoginTimeoutId = GLib.timeout_add (GLib.PRIORITY_DEFAULT,
- 33,
- Lang.bind(this, function() {
- let currentTime = GLib.get_monotonic_time();
- let elapsedTime = (currentTime - startTime) / GLib.USEC_PER_SEC;
- this._timedLoginIndicator.scale_x = elapsedTime / time;
- if (elapsedTime >= time) {
- this._timedLoginTimeoutId = 0;
- hold.release();
- return GLib.SOURCE_REMOVE;
- }
-
- return GLib.SOURCE_CONTINUE;
- }));
+ this._timedLoginTimeoutId = GLib.timeout_add (GLib.PRIORITY_DEFAULT, 33,
+ () => {
+ let currentTime = GLib.get_monotonic_time();
+ let elapsedTime = (currentTime - startTime) / GLib.USEC_PER_SEC;
+ this._timedLoginIndicator.scale_x = elapsedTime / time;
+ if (elapsedTime >= time) {
+ this._timedLoginTimeoutId = 0;
+ hold.release();
+ return GLib.SOURCE_REMOVE;
+ }
+
+ return GLib.SOURCE_CONTINUE;
+ });
GLib.Source.set_name_by_id(this._timedLoginTimeoutId, '[gnome-shell] this._timedLoginTimeoutId');
let focusSet = this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
if (!focusSet) {
- Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
+ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._moveFocusToItems();
return false;
- }));
+ });
}
},
Lang.bind(this, this._onItemActivated));
// Try to keep the focused item front-and-center
- item.actor.connect('key-focus-in',
- Lang.bind(this,
- function() {
- this.scrollToItem(item);
- }));
+ item.actor.connect('key-focus-in', () => { this.scrollToItem(item); });
this._moveFocusToItems();
Main.uiGroup.add_actor(this._menu.actor);
this._menu.actor.hide();
- this._menu.connect('open-state-changed',
- Lang.bind(this, function(menu, isOpen) {
- if (isOpen)
- this._button.add_style_pseudo_class('active');
- else
- this._button.remove_style_pseudo_class('active');
- }));
+ this._menu.connect('open-state-changed', (menu, isOpen) => {
+ if (isOpen)
+ this._button.add_style_pseudo_class('active');
+ else
+ this._button.remove_style_pseudo_class('active');
+ });
this._manager = new PopupMenu.PopupMenuManager({ actor: this._button });
this._manager.addMenu(this._menu);
- this._button.connect('clicked', Lang.bind(this, function() {
- this._menu.toggle();
- }));
+ this._button.connect('clicked', () => { this._menu.toggle(); });
this._items = {};
this._activeSessionId = null;
this._menu.addMenuItem(item);
this._items[id] = item;
- item.connect('activate', Lang.bind(this, function() {
+ item.connect('activate', () => {
this.setActiveSession(id);
this.emit('session-activated', this._activeSessionId);
- }));
+ });
}
}
});
this.actor.add_child(this._logoBin);
this._updateLogo();
- this._userList.connect('activate',
- Lang.bind(this, function(userList, item) {
- this._onUserListActivated(item);
- }));
+ this._userList.connect('activate', (userList, item) => {
+ this._onUserListActivated(item);
+ });
this._sessionMenuButton = new SessionMenuButton();
this._sessionMenuButton.connect('session-activated',
- Lang.bind(this, function(list, sessionId) {
- this._greeter.call_select_session_sync (sessionId, null);
- }));
+ (list, sessionId) => {
+ this._greeter.call_select_session_sync (sessionId, null);
+ });
this._sessionMenuButton.actor.opacity = 0;
this._sessionMenuButton.actor.show();
this._authPrompt.addActorToDefaultButtonWell(this._sessionMenuButton.actor);
_ensureUserListLoaded() {
if (!this._userManager.is_loaded) {
this._userManagerLoadedId = this._userManager.connect('notify::is-loaded',
- Lang.bind(this, function() {
- if (this._userManager.is_loaded) {
- this._loadUserList();
- this._userManager.disconnect(this._userManagerLoadedId);
- this._userManagerLoadedId = 0;
- }
- }));
+ () => {
+ if (this._userManager.is_loaded) {
+ this._loadUserList();
+ this._userManager.disconnect(this._userManagerLoadedId);
+ this._userManagerLoadedId = 0;
+ }
+ });
} else {
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, this._loadUserList));
GLib.Source.set_name_by_id(id, '[gnome-shell] _loadUserList');
if (this._nextSignalId)
this._authPrompt.disconnect(this._nextSignalId);
this._nextSignalId = this._authPrompt.connect('next',
- Lang.bind(this, function() {
- this._authPrompt.disconnect(this._nextSignalId);
- this._nextSignalId = 0;
- this._authPrompt.updateSensitivity(false);
- let answer = this._authPrompt.getAnswer();
- this._user = this._userManager.get_user(answer);
- this._authPrompt.clear();
- this._authPrompt.startSpinning();
- this._authPrompt.begin({ userName: answer });
- this._updateCancelButton();
- }));
+ () => {
+ this._authPrompt.disconnect(this._nextSignalId);
+ this._nextSignalId = 0;
+ this._authPrompt.updateSensitivity(false);
+ let answer = this._authPrompt.getAnswer();
+ this._user = this._userManager.get_user(answer);
+ this._authPrompt.clear();
+ this._authPrompt.startSpinning();
+ this._authPrompt.begin({ userName: answer });
+ this._updateCancelButton();
+ });
this._updateCancelButton();
this._sessionMenuButton.updateSensitivity(false);
_gotGreeterSessionProxy(proxy) {
this._greeterSessionProxy = proxy;
this._greeterSessionProxyChangedId =
- proxy.connect('g-properties-changed', Lang.bind(this, function() {
+ proxy.connect('g-properties-changed', () => {
if (proxy.Active)
this._loginScreenSessionActivated();
- }));
+ });
},
_startSession(serviceName) {
},
_onSessionOpened(client, serviceName) {
- this._authPrompt.finish(Lang.bind(this, function() {
- this._startSession(serviceName);
- }));
+ this._authPrompt.finish(() => { this._startSession(serviceName); });
},
_waitForItemForUser(userName) {
let hold = new Batch.Hold();
let signalId = this._userList.connect('item-added',
- Lang.bind(this, function() {
- let item = this._userList.getItemFromUserName(userName);
+ () => {
+ let item = this._userList.getItemFromUserName(userName);
- if (item)
- hold.release();
- }));
+ if (item)
+ hold.release();
+ });
- hold.connect('release', Lang.bind(this, function() {
- this._userList.disconnect(signalId);
- }));
+ hold.connect('release', () => { this._userList.disconnect(signalId); });
return hold;
},
let hold = new Batch.Hold();
this._timedLoginIdleTimeOutId = Mainloop.timeout_add_seconds(_TIMED_LOGIN_IDLE_THRESHOLD,
- function() {
- this._timedLoginAnimationTime -= _TIMED_LOGIN_IDLE_THRESHOLD;
- hold.release();
- return GLib.SOURCE_REMOVE;
- });
+ () => {
+ this._timedLoginAnimationTime -= _TIMED_LOGIN_IDLE_THRESHOLD;
+ hold.release();
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(this._timedLoginIdleTimeOutId, '[gnome-shell] this._timedLoginAnimationTime');
return hold;
},
this._timedLoginDelay = delay;
this._timedLoginAnimationTime = delay;
- let tasks = [function() {
- return this._waitForItemForUser(userName);
- },
+ let tasks = [() => this._waitForItemForUser(userName),
- function() {
+ () => {
this._timedLoginItem = this._userList.getItemFromUserName(userName);
},
- function() {
+ () => {
// If we're just starting out, start on the right
// item.
if (!this._userManager.is_loaded) {
this._blockTimedLoginUntilIdle,
- function() {
+ () => {
this._userList.scrollToItem(this._timedLoginItem);
},
this._showTimedLoginAnimation,
- function() {
+ () => {
this._timedLoginBatch = null;
this._greeter.call_begin_auto_login_sync(userName, null);
}];
_onTimedLoginRequested(client, userName, seconds) {
this._startTimedLogin(userName, seconds);
- global.stage.connect('captured-event',
- Lang.bind(this, function(actor, event) {
- if (this._timedLoginDelay == undefined)
- return Clutter.EVENT_PROPAGATE;
-
- if (event.type() == Clutter.EventType.KEY_PRESS ||
- event.type() == Clutter.EventType.BUTTON_PRESS) {
- if (this._timedLoginBatch) {
- this._timedLoginBatch.cancel();
- this._timedLoginBatch = null;
- }
- } else if (event.type() == Clutter.EventType.KEY_RELEASE ||
- event.type() == Clutter.EventType.BUTTON_RELEASE) {
- this._resetTimedLogin();
- }
-
- return Clutter.EVENT_PROPAGATE;
- }));
+ global.stage.connect('captured-event', (actor, event) => {
+ if (this._timedLoginDelay == undefined)
+ return Clutter.EVENT_PROPAGATE;
+
+ if (event.type() == Clutter.EventType.KEY_PRESS ||
+ event.type() == Clutter.EventType.BUTTON_PRESS) {
+ if (this._timedLoginBatch) {
+ this._timedLoginBatch.cancel();
+ this._timedLoginBatch = null;
+ }
+ } else if (event.type() == Clutter.EventType.KEY_RELEASE ||
+ event.type() == Clutter.EventType.BUTTON_RELEASE) {
+ this._resetTimedLogin();
+ }
+
+ return Clutter.EVENT_PROPAGATE;
+ });
},
_setUserListExpanded(expanded) {
this._updateDisableUserList();
this._userAddedId = this._userManager.connect('user-added',
- Lang.bind(this, function(userManager, user) {
- this._userList.addUser(user);
- this._updateDisableUserList();
- }));
+ (userManager, user) => {
+ this._userList.addUser(user);
+ this._updateDisableUserList();
+ });
this._userRemovedId = this._userManager.connect('user-removed',
- Lang.bind(this, function(userManager, user) {
- this._userList.removeUser(user);
- this._updateDisableUserList();
- }));
+ (userManager, user) => {
+ this._userList.removeUser(user);
+ this._updateDisableUserList();
+ });
this._userChangedId = this._userManager.connect('user-changed',
- Lang.bind(this, function(userManager, user) {
- if (this._userList.containsUser(user) && user.locked)
- this._userList.removeUser(user);
- else if (!this._userList.containsUser(user) && !user.locked)
- this._userList.addUser(user);
- this._updateDisableUserList();
- }));
+ (userManager, user) => {
+ if (this._userList.containsUser(user) && user.locked)
+ this._userList.removeUser(user);
+ else if (!this._userList.containsUser(user) && !user.locked)
+ this._userList.addUser(user);
+ this._updateDisableUserList();
+ });
return GLib.SOURCE_REMOVE;
},
this._realms = {};
this._signalId = this._aggregateProvider.connect('g-properties-changed',
- Lang.bind(this, function(proxy, properties) {
- if ('Realms' in properties.deep_unpack())
- this._reloadRealms();
- }));
+ (proxy, properties) => {
+ if ('Realms' in properties.deep_unpack())
+ this._reloadRealms();
+ });
},
_reloadRealms() {
this._reloadRealm(realm);
- realm.connect('g-properties-changed',
- Lang.bind(this, function(proxy, properties) {
- if ('Configured' in properties.deep_unpack())
- this._reloadRealm(realm);
- }));
+ realm.connect('g-properties-changed', (proxy, properties) => {
+ if ('Configured' in properties.deep_unpack())
+ this._reloadRealm(realm);
+ });
},
_updateLoginFormat() {
Service(Gio.DBus.system,
'org.freedesktop.realmd',
'/org/freedesktop/realmd',
- function(service) {
- service.ReleaseRemote();
- });
+ service => { service.ReleaseRemote(); });
this._aggregateProvider.disconnect(this._signalId);
this._realms = { };
this._updateLoginFormat();
if (!this.hasPendingMessages) {
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
} else {
- let signalId = this.connect('no-more-messages',
- Lang.bind(this, function() {
- this.disconnect(signalId);
- this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
- }));
+ let signalId = this.connect('no-more-messages', () => {
+ this.disconnect(signalId);
+ this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
+ });
}
},
this._messageQueueTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
message.interval,
- Lang.bind(this, function() {
+ () => {
this._messageQueueTimeoutId = 0;
this._queueMessageTimeout();
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(this._messageQueueTimeoutId, '[gnome-shell] this._queueMessageTimeout');
},
return;
}
- this._fprintManager.GetDefaultDeviceRemote(Gio.DBusCallFlags.NONE, this._cancellable, Lang.bind(this,
- function(device, error) {
+ this._fprintManager.GetDefaultDeviceRemote(Gio.DBusCallFlags.NONE, this._cancellable,
+ (device, error) => {
if (!error && device) {
this._haveFingerprintReader = true;
this._updateDefaultService();
}
- }));
+ });
},
_oVirtUserAuthenticated(token) {
this._userVerifier.call_begin_verification_for_user(serviceName,
this._userName,
this._cancellable,
- Lang.bind(this, function(obj, result) {
+ (obj, result) => {
try {
obj.call_begin_verification_for_user_finish(result);
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
}
this._hold.release();
- }));
+ });
} else {
this._userVerifier.call_begin_verification(serviceName,
this._cancellable,
- Lang.bind(this, function(obj, result) {
+ (obj, result) => {
try {
obj.call_begin_verification_finish(result);
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
}
this._hold.release();
- }));
+ });
}
},
if (!this.hasPendingMessages) {
this._retry();
} else {
- let signalId = this.connect('no-more-messages',
- Lang.bind(this, function() {
- this.disconnect(signalId);
- if (this._cancellable && !this._cancellable.is_cancelled())
- this._retry();
- }));
+ let signalId = this.connect('no-more-messages', () => {
+ this.disconnect(signalId);
+ if (this._cancellable && !this._cancellable.is_cancelled())
+ this._retry();
+ });
}
} else {
if (!this.hasPendingMessages) {
this._cancelAndReset();
} else {
- let signalId = this.connect('no-more-messages',
- Lang.bind(this, function() {
- this.disconnect(signalId);
- this._cancelAndReset();
- }));
+ let signalId = this.connect('no-more-messages', () => {
+ this.disconnect(signalId);
+ this._cancelAndReset();
+ });
}
}
} catch (e) {
}
// If an engine is already active we need to get its properties
- this._ibus.get_global_engine_async(-1, null, Lang.bind(this, function(i, result) {
+ this._ibus.get_global_engine_async(-1, null, (i, result) => {
let engine;
try {
engine = this._ibus.get_global_engine_async_finish(result);
return;
}
this._engineChanged(this._ibus, engine.get_name());
- }));
+ });
this._updateReadiness();
} else {
this._clear();
return;
this._registerPropertiesId =
- this._panelService.connect('register-properties', Lang.bind(this, function(p, props) {
+ this._panelService.connect('register-properties', (p, props) => {
if (!props.get(0))
return;
this._registerPropertiesId = 0;
this.emit('properties-registered', this._currentEngineName, props);
- }));
+ });
},
_updateProperty(panel, prop) {
this._preloadEnginesId =
Mainloop.timeout_add_seconds(this._PRELOAD_ENGINES_DELAY_TIME,
- Lang.bind(this, function() {
+ () => {
this._ibus.preload_engines_async(
ids,
-1,
null);
this._preloadEnginesId = 0;
return GLib.SOURCE_REMOVE;
- }));
+ });
},
});
Signals.addSignalMethods(IBusManager.prototype);
_setContext(bus, res) {
this._context = this._ibus.create_input_context_async_finish(res);
- this._context.connect('enabled', Lang.bind(this, function () { this._enabled = true }));
- this._context.connect('disabled', Lang.bind(this, function () { this._enabled = false }));
+ this._context.connect('enabled', () => { this._enabled = true });
+ this._context.connect('disabled', () => { this._enabled = false });
this._context.connect('commit-text', Lang.bind(this, this._onCommitText));
this._context.connect('delete-surrounding-text', Lang.bind(this, this._onDeleteSurroundingText));
this._context.connect('update-preedit-text', Lang.bind(this, this._onUpdatePreeditText));
this._context.process_key_event_async(event.get_key_symbol(),
event.get_key_code() - 8, // Convert XKB keycodes to evcodes
state, -1, null,
- Lang.bind(this, (context, res) => {
+ (context, res) => {
try {
let retval = context.process_key_event_async_finish(res);
this.notify_key_event(event, retval);
} catch (e) {
log('Error processing key on IM: ' + e.message);
}
- }));
+ });
return true;
},
});
if (matches) {
[expr, base, attrHead] = matches;
- methods = getPropertyNamesFromExpression(base, commandHeader).filter(function(attr) {
- return attr.slice(0, attrHead.length) == attrHead;
- });
+ methods = getPropertyNamesFromExpression(base, commandHeader).filter(
+ attr => attr.slice(0, attrHead.length) == attrHead
+ );
}
// Look for the empty expression or partially entered words
matches = text.match(/^(\w*)$/);
if (text == '' || matches) {
[expr, attrHead] = matches;
- methods = globalCompletionList.filter(function(attr) {
- return attr.slice(0, attrHead.length) == attrHead;
- });
+ methods = globalCompletionList.filter(
+ attr => attr.slice(0, attrHead.length) == attrHead
+ );
}
}
// Make sure propsUnique contains one key for every
// property so we end up with a unique list of properties
- allProps.map(function(p){ propsUnique[p] = null; });
+ allProps.map(p => propsUnique[p] = null);
}
return Object.keys(propsUnique).sort();
}
// Returns a list of global keywords derived from str
function getDeclaredConstants(str) {
let ret = [];
- str.split(';').forEach(function(s) {
+ str.split(';').forEach(s => {
let base, keyword;
let match = s.match(/const\s+(\w+)\s*=/);
if (match) {
_buildGroupStrings(_group) {
let group = _group.concat(this._localeLayoutInfo);
- let layouts = group.map(function(g) { return g.layout; }).join(',');
- let variants = group.map(function(g) { return g.variant; }).join(',');
+ let layouts = group.map(g => g.layout).join(',');
+ let variants = group.map(g => g.variant).join(',');
return [layouts, variants];
},
return;
}
- this._proxy.GetSessionRemote(sessionId, Lang.bind(this,
- function(result, error) {
- if (error) {
- logError(error, 'Could not get a proxy for the current session');
- } else {
- this._currentSession = new SystemdLoginSession(Gio.DBus.system,
- 'org.freedesktop.login1',
- result[0]);
- callback(this._currentSession);
- }
- }));
+ this._proxy.GetSessionRemote(sessionId, (result, error) => {
+ if (error) {
+ logError(error, 'Could not get a proxy for the current session');
+ } else {
+ this._currentSession = new SystemdLoginSession(Gio.DBus.system,
+ 'org.freedesktop.login1',
+ result[0]);
+ callback(this._currentSession);
+ }
+ });
},
canSuspend(asyncCallback) {
- this._proxy.CanSuspendRemote(function(result, error) {
+ this._proxy.CanSuspendRemote((result, error) => {
if (error) {
asyncCallback(false, false);
} else {
},
listSessions(asyncCallback) {
- this._proxy.ListSessionsRemote(function(result, error) {
+ this._proxy.ListSessionsRemote((result, error) => {
if (error)
asyncCallback([]);
else
reason,
'delay']);
this._proxy.call_with_unix_fd_list('Inhibit', inVariant, 0, -1, null, null,
- Lang.bind(this, function(proxy, result) {
+ (proxy, result) => {
let fd = -1;
try {
let [outVariant, fdList] = proxy.call_with_unix_fd_list_finish(result);
logError(e, "Error getting systemd inhibitor");
callback(null);
}
- }));
+ });
},
_prepareForSleep(proxy, sender, [aboutToSuspend]) {
this.operator_name = null;
// Code is duplicated because the function have different signatures
- this._proxy.connectSignal('SignalQuality', Lang.bind(this, function(proxy, sender, [quality]) {
+ this._proxy.connectSignal('SignalQuality', (proxy, sender, [quality]) => {
this.signal_quality = quality;
this.emit('notify::signal-quality');
- }));
- this._proxy.connectSignal('RegistrationInfo', Lang.bind(this, function(proxy, sender, [status, code, name]) {
+ });
+ this._proxy.connectSignal('RegistrationInfo', (proxy, sender, [status, code, name]) => {
this.operator_name = _findProviderForMccMnc(name, code);
this.emit('notify::operator-name');
- }));
- this._proxy.GetRegistrationInfoRemote(Lang.bind(this, function([result], err) {
+ });
+ this._proxy.GetRegistrationInfoRemote(([result], err) => {
if (err) {
log(err);
return;
let [status, code, name] = result;
this.operator_name = _findProviderForMccMnc(name, code);
this.emit('notify::operator-name');
- }));
- this._proxy.GetSignalQualityRemote(Lang.bind(this, function(result, err) {
+ });
+ this._proxy.GetSignalQualityRemote((result, err) => {
if (err) {
// it will return an error if the device is not connected
this.signal_quality = 0;
this.signal_quality = quality;
}
this.emit('notify::signal-quality');
- }));
+ });
}
});
Signals.addSignalMethods(ModemGsm.prototype);
this.signal_quality = 0;
this.operator_name = null;
- this._proxy.connectSignal('SignalQuality', Lang.bind(this, function(proxy, sender, params) {
+ this._proxy.connectSignal('SignalQuality', (proxy, sender, params) => {
this.signal_quality = params[0];
this.emit('notify::signal-quality');
// and we can finally call GetServingSystem
if (this.operator_name == null)
this._refreshServingSystem();
- }));
- this._proxy.GetSignalQualityRemote(Lang.bind(this, function(result, err) {
+ });
+ this._proxy.GetSignalQualityRemote((result, err) => {
if (err) {
// it will return an error if the device is not connected
this.signal_quality = 0;
this.signal_quality = quality;
}
this.emit('notify::signal-quality');
- }));
+ });
},
_refreshServingSystem() {
- this._proxy.GetServingSystemRemote(Lang.bind(this, function([result], err) {
+ this._proxy.GetServingSystemRemote(([result], err) => {
if (err) {
// it will return an error if the device is not connected
this.operator_name = null;
this.operator_name = _findProviderForSid(sid)
}
this.emit('notify::operator-name');
- }));
+ });
}
});
Signals.addSignalMethods(ModemCdma.prototype);
this._proxy_cdma = new BroadbandModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
this._capabilities = capabilities;
- this._proxy.connect('g-properties-changed', Lang.bind(this, function(proxy, properties) {
+ this._proxy.connect('g-properties-changed', (proxy, properties) => {
if ('SignalQuality' in properties.deep_unpack())
this._reloadSignalQuality();
- }));
+ });
this._reloadSignalQuality();
- this._proxy_3gpp.connect('g-properties-changed', Lang.bind(this, function(proxy, properties) {
+ this._proxy_3gpp.connect('g-properties-changed', (proxy, properties) => {
let unpacked = properties.deep_unpack();
if ('OperatorName' in unpacked || 'OperatorCode' in unpacked)
this._reload3gppOperatorName();
- }));
+ });
this._reload3gppOperatorName();
- this._proxy_cdma.connect('g-properties-changed', Lang.bind(this, function(proxy, properties) {
+ this._proxy_cdma.connect('g-properties-changed', (proxy, properties) => {
let unpacked = properties.deep_unpack();
if ('Nid' in unpacked || 'Sid' in unpacked)
this._reloadCdmaOperatorName();
- }));
+ });
this._reloadCdmaOperatorName();
},
proxy.init_async(GLib.PRIORITY_DEFAULT,
this._cancellable,
- Lang.bind(this, function(initable, result) {
+ (initable, result) => {
let error = null;
try {
initable.init_finish(result);
if (onFinished)
onFinished();
- }));
+ });
},
_removeInterface(objectPath, interfaceName) {
}
this._managerProxy.connectSignal('InterfacesAdded',
- Lang.bind(this, function(objectManager, sender, [objectPath, interfaces]) {
+ (objectManager, sender, [objectPath, interfaces]) => {
let interfaceNames = Object.keys(interfaces);
for (let i = 0; i < interfaceNames.length; i++)
this._addInterface(objectPath, interfaceNames[i]);
- }));
+ });
this._managerProxy.connectSignal('InterfacesRemoved',
- Lang.bind(this, function(objectManager, sender, [objectPath, interfaceNames]) {
+ (objectManager, sender, [objectPath, interfaceNames]) => {
for (let i = 0; i < interfaceNames.length; i++)
this._removeInterface(objectPath, interfaceNames[i]);
- }));
+ });
if (Object.keys(this._interfaceInfos).length == 0) {
this._tryToCompleteLoad();
return;
}
- this._managerProxy.connect('notify::g-name-owner', Lang.bind(this, function() {
+ this._managerProxy.connect('notify::g-name-owner', () => {
if (this._managerProxy.g_name_owner)
this._onNameAppeared();
else
this._onNameVanished();
- }));
+ });
if (this._managerProxy.g_name_owner)
this._onNameAppeared();
},
_onNameAppeared() {
- this._managerProxy.GetManagedObjectsRemote(Lang.bind(this, function(result, error) {
+ this._managerProxy.GetManagedObjectsRemote((result, error) => {
if (!result) {
if (error) {
logError(error, 'could not get remote objects for service ' + this._serviceName + ' path ' + this._managerPath);
}
}
this._tryToCompleteLoad();
- }));
+ });
},
_onNameVanished() {
for (let i = 0; i < tokens.length; i++)
this._addToken(tokens[i]);
- this._objectManager.connect('interface-added', Lang.bind(this, function(objectManager, interfaceName, proxy) {
+ this._objectManager.connect('interface-added', (objectManager, interfaceName, proxy) => {
if (interfaceName == 'org.gnome.SettingsDaemon.Smartcard.Token')
this._addToken(proxy);
- }));
+ });
- this._objectManager.connect('interface-removed', Lang.bind(this, function(objectManager, interfaceName, proxy) {
+ this._objectManager.connect('interface-removed', (objectManager, interfaceName, proxy) => {
if (interfaceName == 'org.gnome.SettingsDaemon.Smartcard.Token')
this._removeToken(proxy);
- }));
+ });
},
_updateToken(token) {
_addToken(token) {
this._updateToken(token);
- token.connect('g-properties-changed',
- Lang.bind(this, function(proxy, properties) {
- if ('IsInserted' in properties.deep_unpack()) {
- this._updateToken(token);
-
- if (token.IsInserted) {
- this.emit('smartcard-inserted', token);
- } else {
- this.emit('smartcard-removed', token);
- }
- }
- }));
+ token.connect('g-properties-changed', (proxy, properties) => {
+ if ('IsInserted' in properties.deep_unpack()) {
+ this._updateToken(token);
+
+ if (token.IsInserted) {
+ this.emit('smartcard-inserted', token);
+ } else {
+ this.emit('smartcard-removed', token);
+ }
+ }
+ });
// Emit a smartcard-inserted at startup if it's already plugged in
if (token.IsInserted)
if (Main.screenShield)
Main.screenShield.lock(false);
- Clutter.threads_add_repaint_func_full(Clutter.RepaintFlags.POST_PAINT, function() {
+ Clutter.threads_add_repaint_func_full(Clutter.RepaintFlags.POST_PAINT, () => {
Gdm.goto_login_session_sync(null);
return false;
});
// Dummy child watch; we don't want to double-fork internally
// because then we lose the parent-child relationship, which
// can break polkit. See https://bugzilla.redhat.com//show_bug.cgi?id=819275
- GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, function () {});
+ GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, () => {});
}
// trySpawnCommandLine:
_desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
let label = new St.Label({ text: formatTime(date, params) });
- let id = _desktopSettings.connect('changed::clock-format', function() {
+ let id = _desktopSettings.connect('changed::clock-format', () => {
label.text = formatTime(date, params);
});
- label.connect('destroy', function() {
- _desktopSettings.disconnect(id);
- });
+ label.connect('destroy', () => { _desktopSettings.disconnect(id); });
return label;
}
function lowerBound(array, val, cmp) {
let min, max, mid, v;
- cmp = cmp || function(a, b) { return a - b; };
+ cmp = cmp || ((a, b) => a - b);
if (array.length == 0)
return 0;
// Enable recording of timestamps for different points in the frame cycle
global.frame_timestamps = true;
- Main.overview.connect('shown', function() {
- Scripting.scriptEvent('overviewShowDone');
- });
+ Main.overview.connect('shown', () => {
+ Scripting.scriptEvent('overviewShowDone');
+ });
yield Scripting.sleep(1000);
let timeline = new Clutter.Timeline({ duration: milliseconds });
timeline.start();
- timeline.connect('new-frame',
- function(timeline, frame) {
- global.stage.queue_redraw();
- });
-
- timeline.connect('completed',
- function() {
- timeline.stop();
- if (cb)
- cb();
- });
-
- return function(callback) {
- cb = callback;
- };
+ timeline.connect('new-frame', (timeline, frame) => {
+ global.stage.queue_redraw();
+ });
+
+ timeline.connect('completed', () => {
+ timeline.stop();
+ if (cb)
+ cb();
+ });
+
+ return callback => { cb = callback; };
}
function waitSignal(object, signal) {
let cb;
- let id = object.connect(signal, function() {
+ let id = object.connect(signal, () => {
object.disconnect(id);
if (cb)
cb();
});
- return function(callback) {
- cb = callback;
- };
+ return callback => { cb = callback; };
}
function extractBootTimestamp() {
function script_collectTimings(time) {
for (let timing in redrawTimes) {
let times = redrawTimes[timing];
- times.sort(function(a, b) { return a - b });
+ times.sort((a, b) => a - b);
let len = times.length;
let median;
if (top.window != null)
return;
- top.window = new PortalWindow(this, top.url, top.timestamp, Lang.bind(this, function(result) {
+ top.window = new PortalWindow(this, top.url, top.timestamp, result => {
this._dbusImpl.emit_signal('Done', new GLib.Variant('(ou)', [top.connection, result]));
- }));
+ });
},
});
{ opacity: 0,
time: THUMBNAIL_FADE_TIME,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this, function() {
- thumbnailsActor.destroy();
- this.thumbnailsVisible = false;
- })
+ onComplete: () => {
+ thumbnailsActor.destroy();
+ this.thumbnailsVisible = false;
+ }
});
this._thumbnails = null;
if (this._switcherList._items[this._selectedIndex])
{ opacity: 255,
time: THUMBNAIL_FADE_TIME,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this, function () { this.thumbnailsVisible = true; })
+ onComplete: () => { this.thumbnailsVisible = true; }
});
this._switcherList._items[this._selectedIndex].add_accessible_state (Atk.StateType.EXPANDED);
let appIcon = new AppIcon(apps[i]);
// Cache the window list now; we don't handle dynamic changes here,
// and we don't want to be continually retrieving it
- appIcon.cachedWindows = allWindows.filter(function(w) {
- return windowTracker.get_window_app (w) == appIcon.app;
- });
+ appIcon.cachedWindows = allWindows.filter(
+ w => windowTracker.get_window_app (w) == appIcon.app
+ );
if (appIcon.cachedWindows.length > 0)
this._addIcon(appIcon);
}
let availWidth = primary.width - parentPadding - this.actor.get_theme_node().get_horizontal_padding();
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
- let iconSizes = baseIconSizes.map(function(s) {
- return s * scaleFactor;
- });
+ let iconSizes = baseIconSizes.map(s => s * scaleFactor);
if (this._items.length == 1) {
this._iconSize = baseIconSizes[0];
Mainloop.source_remove(this._mouseTimeOutId);
if (this._altTabPopup.thumbnailsVisible) {
this._mouseTimeOutId = Mainloop.timeout_add(APP_ICON_HOVER_TIMEOUT,
- Lang.bind(this, function () {
- this._enterItem(index);
- this._mouseTimeOutId = 0;
- return GLib.SOURCE_REMOVE;
- }));
+ () => {
+ this._enterItem(index);
+ this._mouseTimeOutId = 0;
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(this._mouseTimeOutId, '[gnome-shell] this._enterItem');
} else
this._itemEntered(index);
let n = this._arrows.length;
let arrow = new St.DrawingArea({ style_class: 'switcher-arrow' });
- arrow.connect('repaint', function() { SwitcherPopup.drawArrow(arrow, St.Side.BOTTOM); });
+ arrow.connect('repaint', () => { SwitcherPopup.drawArrow(arrow, St.Side.BOTTOM); });
this._list.add_actor(arrow);
this._arrows.push(arrow);
else
this._grid = new IconGrid.IconGrid(gridParams);
- this._grid.connect('key-focus-in', Lang.bind(this, function(grid, actor) {
+ this._grid.connect('key-focus-in', (grid, actor) => {
this._keyFocusIn(actor);
- }));
+ });
// Standard hack for ClutterBinLayout
this._grid.actor.x_expand = true;
loadGrid() {
this._allItems.sort(this._compareItems);
- this._allItems.forEach(Lang.bind(this, function(item) {
- this._grid.addItem(item);
- }));
+ this._allItems.forEach(item => { this._grid.addItem(item); });
this.emit('view-loaded');
},
this._selectAppInternal(id);
} else if (this._items[id]) {
// Need to wait until the view is mapped
- let signalId = this._items[id].actor.connect('notify::mapped', Lang.bind(this, function(actor) {
- if (actor.mapped) {
- actor.disconnect(signalId);
- this._selectAppInternal(id);
- }
- }));
+ let signalId = this._items[id].actor.connect('notify::mapped',
+ actor => {
+ if (actor.mapped) {
+ actor.disconnect(signalId);
+ this._selectAppInternal(id);
+ }
+ });
} else {
// Need to wait until the view is built
- let signalId = this.connect('view-loaded', Lang.bind(this, function() {
+ let signalId = this.connect('view-loaded', () => {
this.disconnect(signalId);
this.selectApp(id);
- }));
+ });
}
},
animate(animationDirection, onComplete) {
if (onComplete) {
- let animationDoneId = this._grid.connect('animation-done', Lang.bind(this,
- function () {
- this._grid.disconnect(animationDoneId);
- onComplete();
- }));
+ let animationDoneId = this._grid.connect('animation-done', () => {
+ this._grid.disconnect(animationDoneId);
+ onComplete();
+ });
}
if (animationDirection == IconGrid.AnimationDirection.IN) {
} else {
params.opacity = 0;
params.delay = 0;
- params.onComplete = Lang.bind(this, function() { this.actor.hide() });
+ params.onComplete = () => { this.actor.hide(); };
}
Tweener.addTween(this._grid.actor, params);
this._nPages = 0;
this._currentPage = undefined;
- this.actor.connect('notify::mapped',
- Lang.bind(this, function() {
- this.animateIndicators(IconGrid.AnimationDirection.IN);
- })
- );
+ this.actor.connect('notify::mapped', () => {
+ this.animateIndicators(IconGrid.AnimationDirection.IN);
+ });
},
setNPages(nPages) {
toggle_mode: true,
checked: pageIndex == this._currentPage });
indicator.child = new St.Widget({ style_class: 'page-indicator-icon' });
- indicator.connect('clicked', Lang.bind(this,
- function() {
- this.emit('page-activated', pageIndex);
- }));
+ indicator.connect('clicked', () => {
+ this.emit('page-activated', pageIndex);
+ });
this.actor.add_actor(indicator);
}
} else {
this._adjustment = this._scrollView.vscroll.adjustment;
this._pageIndicators = new PageIndicators();
- this._pageIndicators.connect('page-activated', Lang.bind(this,
- function(indicators, pageIndex) {
+ this._pageIndicators.connect('page-activated',
+ (indicators, pageIndex) => {
this.goToPage(pageIndex);
- }));
+ });
this._pageIndicators.actor.connect('scroll-event', Lang.bind(this, this._onScroll));
this.actor.add_actor(this._pageIndicators.actor);
this._scrollView.add_action(panAction);
this._panning = false;
this._clickAction = new Clutter.ClickAction();
- this._clickAction.connect('clicked', Lang.bind(this, function() {
+ this._clickAction.connect('clicked', () => {
if (!this._currentPopup)
return;
let actor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
if (!this._currentPopup.actor.contains(actor))
this._currentPopup.popdown();
- }));
+ });
this._eventBlocker.add_action(this._clickAction);
this._displayingPopup = false;
this._availWidth = 0;
this._availHeight = 0;
- Main.overview.connect('hidden', Lang.bind(this,
- function() {
- this.goToPage(0);
- }));
- this._grid.connect('space-opened', Lang.bind(this,
- function() {
- let fadeEffect = this._scrollView.get_effect('fade');
- if (fadeEffect)
- fadeEffect.enabled = false;
-
- this.emit('space-ready');
- }));
- this._grid.connect('space-closed', Lang.bind(this,
- function() {
- this._displayingPopup = false;
- }));
-
- this.actor.connect('notify::mapped', Lang.bind(this,
- function() {
- if (this.actor.mapped) {
- this._keyPressEventId =
- global.stage.connect('key-press-event',
- Lang.bind(this, this._onKeyPressEvent));
- } else {
- if (this._keyPressEventId)
- global.stage.disconnect(this._keyPressEventId);
- this._keyPressEventId = 0;
- }
- }));
+ Main.overview.connect('hidden', () => { this.goToPage(0); });
+ this._grid.connect('space-opened', () => {
+ let fadeEffect = this._scrollView.get_effect('fade');
+ if (fadeEffect)
+ fadeEffect.enabled = false;
+
+ this.emit('space-ready');
+ });
+ this._grid.connect('space-closed', () => {
+ this._displayingPopup = false;
+ });
+
+ this.actor.connect('notify::mapped', () => {
+ if (this.actor.mapped) {
+ this._keyPressEventId =
+ global.stage.connect('key-press-event',
+ Lang.bind(this, this._onKeyPressEvent));
+ } else {
+ if (this._keyPressEventId)
+ global.stage.disconnect(this._keyPressEventId);
+ this._keyPressEventId = 0;
+ }
+ });
this._redisplayWorkId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._redisplay));
- Shell.AppSystem.get_default().connect('installed-changed', Lang.bind(this, function() {
+ Shell.AppSystem.get_default().connect('installed-changed', () => {
Main.queueDeferredWork(this._redisplayWorkId);
- }));
+ });
this._folderSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.app-folders' });
- this._folderSettings.connect('changed::folder-children', Lang.bind(this, function() {
+ this._folderSettings.connect('changed::folder-children', () => {
Main.queueDeferredWork(this._redisplayWorkId);
- }));
+ });
},
removeAll() {
},
_refilterApps() {
- this._allItems.forEach(function(icon) {
+ this._allItems.forEach(icon => {
if (icon instanceof AppIcon)
icon.actor.visible = true;
});
- this.folderIcons.forEach(Lang.bind(this, function(folder) {
+ this.folderIcons.forEach(folder => {
let folderApps = folder.getAppIds();
- folderApps.forEach(Lang.bind(this, function(appId) {
+ folderApps.forEach(appId => {
let appIcon = this._items[appId];
appIcon.actor.visible = false;
- }));
- }));
+ });
+ });
},
_loadApps() {
- let apps = Gio.AppInfo.get_all().filter(function(appInfo) {
+ let apps = Gio.AppInfo.get_all().filter(appInfo => {
try {
let id = appInfo.get_id(); // catch invalid file encodings
} catch(e) {
return false;
}
return appInfo.should_show();
- }).map(function(app) {
- return app.get_id();
- });
+ }).map(app => app.get_id());
let appSys = Shell.AppSystem.get_default();
let folders = this._folderSettings.get_strv('folder-children');
- folders.forEach(Lang.bind(this, function(id) {
+ folders.forEach(id => {
let path = this._folderSettings.path + 'folders/' + id + '/';
let icon = new FolderIcon(id, path, this);
icon.connect('name-changed', Lang.bind(this, this._itemNameChanged));
icon.connect('apps-changed', Lang.bind(this, this._refilterApps));
this.addItem(icon);
this.folderIcons.push(icon);
- }));
+ });
// Allow dragging of the icon only if the Dash would accept a drop to
// change favorite-apps. There are no other possible drop targets from
// but we hope that is not used much.
let favoritesWritable = global.settings.is_writable('favorite-apps');
- apps.forEach(Lang.bind(this, function(appId) {
+ apps.forEach(appId => {
let app = appSys.lookup_app(appId);
let icon = new AppIcon(app,
{ isDraggable: favoritesWritable });
this.addItem(icon);
- }));
+ });
this.loadGrid();
this._refilterApps();
// Overriden from BaseAppView
animate(animationDirection, onComplete) {
this._scrollView.reactive = false;
- let completionFunc = Lang.bind(this, function() {
+ let completionFunc = () => {
this._scrollView.reactive = true;
if (onComplete)
onComplete();
- });
+ };
if (animationDirection == IconGrid.AnimationDirection.OUT &&
this._displayingPopup && this._currentPopup) {
this._currentPopup.popdown();
- let spaceClosedId = this._grid.connect('space-closed', Lang.bind(this,
- function() {
- this._grid.disconnect(spaceClosedId);
- // Given that we can't call this.parent() inside the
- // signal handler, call again animate which will
- // call the parent given that popup is already
- // closed.
- this.animate(animationDirection, completionFunc);
- }));
+ let spaceClosedId = this._grid.connect('space-closed', () => {
+ this._grid.disconnect(spaceClosedId);
+ // Given that we can't call this.parent() inside the
+ // signal handler, call again animate which will
+ // call the parent given that popup is already
+ // closed.
+ this.animate(animationDirection, completionFunc);
+ });
} else {
this.parent(animationDirection, completionFunc);
if (animationDirection == IconGrid.AnimationDirection.OUT)
addFolderPopup(popup) {
this._stack.add_actor(popup.actor);
- popup.connect('open-state-changed', Lang.bind(this,
- function(popup, isOpen) {
- this._eventBlocker.reactive = isOpen;
- this._currentPopup = isOpen ? popup : null;
- this._updateIconOpacities(isOpen);
- if(!isOpen)
- this._closeSpaceForPopup();
- }));
+ popup.connect('open-state-changed', (popup, isOpen) => {
+ this._eventBlocker.reactive = isOpen;
+ this._currentPopup = isOpen ? popup : null;
+ this._updateIconOpacities(isOpen);
+ if(!isOpen)
+ this._closeSpaceForPopup();
+ });
},
_keyFocusIn(icon) {
if (this._availWidth != availWidth || this._availHeight != availHeight || oldNPages != this._grid.nPages()) {
this._adjustment.value = 0;
this._grid.currentPage = 0;
- Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
- function() {
- this._pageIndicators.setNPages(this._grid.nPages());
- this._pageIndicators.setCurrentPage(0);
- }));
+ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
+ this._pageIndicators.setNPages(this._grid.nPages());
+ this._pageIndicators.setCurrentPage(0);
+ });
}
this._availWidth = availWidth;
this._usage = Shell.AppUsage.get_default();
- this.actor.connect('notify::mapped', Lang.bind(this, function() {
+ this.actor.connect('notify::mapped', () => {
if (this.actor.mapped)
this._redisplay();
- }));
+ });
},
hasUsefulData() {
let layout = new ControlsBoxLayout({ homogeneous: true });
this._controls = new St.Widget({ style_class: 'app-view-controls',
layout_manager: layout });
- this._controls.connect('notify::mapped', Lang.bind(this,
- function() {
- // controls are faded either with their parent or
- // explicitly in animate(); we can't know how they'll be
- // shown next, so make sure to restore their opacity
- // when they are hidden
- if (this._controls.mapped)
- return;
-
- Tweener.removeTweens(this._controls);
- this._controls.opacity = 255;
- }));
+ this._controls.connect('notify::mapped', () => {
+ // controls are faded either with their parent or
+ // explicitly in animate(); we can't know how they'll be
+ // shown next, so make sure to restore their opacity
+ // when they are hidden
+ if (this._controls.mapped)
+ return;
+
+ Tweener.removeTweens(this._controls);
+ this._controls.opacity = 255;
+ });
layout.hookup_style(this._controls);
this.actor.add_actor(new St.Bin({ child: this._controls }));
this._controls.add_actor(this._views[i].control);
let viewIndex = i;
- this._views[i].control.connect('clicked', Lang.bind(this,
- function(actor) {
- this._showView(viewIndex);
- global.settings.set_uint('app-picker-view', viewIndex);
- }));
+ this._views[i].control.connect('clicked', actor => {
+ this._showView(viewIndex);
+ global.settings.set_uint('app-picker-view', viewIndex);
+ });
}
let initialView = Math.min(global.settings.get_uint('app-picker-view'),
this._views.length - 1);
Gio.DBus.system.watch_name(SWITCHEROO_BUS_NAME,
Gio.BusNameWatcherFlags.NONE,
Lang.bind(this, this._switcherooProxyAppeared),
- Lang.bind(this, function() {
+ () => {
this._switcherooProxy = null;
this._updateDiscreteGpuAvailable();
- }));
+ });
},
_updateDiscreteGpuAvailable() {
_switcherooProxyAppeared() {
this._switcherooProxy = new SwitcherooProxy(Gio.DBus.system, SWITCHEROO_BUS_NAME, SWITCHEROO_OBJECT_PATH,
- Lang.bind(this, function(proxy, error) {
+ (proxy, error) => {
if (error) {
log(error.message);
return;
}
this._updateDiscreteGpuAvailable();
- }));
+ });
},
animate(animationDirection, onComplete) {
let enabled = this._privacySettings.get_boolean('remember-app-usage');
this._views[Views.FREQUENT].control.visible = enabled;
- let visibleViews = this._views.filter(function(v) {
- return v.control.visible;
- });
+ let visibleViews = this._views.filter(v => v.control.visible);
this._controls.visible = visibleViews.length > 1;
if (!enabled && this._views[Views.FREQUENT].view.actor.visible)
let groups = Shell.AppSystem.search(query);
let usage = Shell.AppUsage.get_default();
let results = [];
- groups.forEach(function(group) {
- group = group.filter(function(appID) {
+ groups.forEach(group => {
+ group = group.filter(appID => {
let app = Gio.DesktopAppInfo.new(appID);
return app && app.should_show();
});
- results = results.concat(group.sort(function(a, b) {
- return usage.compare('', a, b);
- }));
+ results = results.concat(group.sort(
+ (a, b) => usage.compare('', a, b)
+ ));
});
results = results.concat(this._systemActions.getMatchingActions(terms));
this.view = new FolderView();
- this.actor.connect('clicked', Lang.bind(this,
- function() {
- this._ensurePopup();
- this.view.actor.vscroll.adjustment.value = 0;
- this._openSpaceForPopup();
- }));
- this.actor.connect('notify::mapped', Lang.bind(this,
- function() {
- if (!this.actor.mapped && this._popup)
- this._popup.popdown();
- }));
+ this.actor.connect('clicked', () => {
+ this._ensurePopup();
+ this.view.actor.vscroll.adjustment.value = 0;
+ this._openSpaceForPopup();
+ });
+ this.actor.connect('notify::mapped', () => {
+ if (!this.actor.mapped && this._popup)
+ this._popup.popdown();
+ });
this._folder.connect('changed', Lang.bind(this, this._redisplay));
this._redisplay();
},
getAppIds() {
- return this.view.getAllItems().map(function(item) {
- return item.id;
- });
+ return this.view.getAllItems().map(item => item.id);
},
_updateName() {
let excludedApps = this._folder.get_strv('excluded-apps');
let appSys = Shell.AppSystem.get_default();
- let addAppId = (function addAppId(appId) {
+ let addAppId = appId => {
if (excludedApps.indexOf(appId) >= 0)
return;
let icon = new AppIcon(app);
this.view.addItem(icon);
- }).bind(this);
+ };
let folderApps = this._folder.get_strv('apps');
folderApps.forEach(addAppId);
let folderCategories = this._folder.get_strv('categories');
- Gio.AppInfo.get_all().forEach(function(appInfo) {
+ Gio.AppInfo.get_all().forEach(appInfo => {
let appCategories = _getCategories(appInfo);
if (!_listsIntersect(folderCategories, appCategories))
return;
},
_openSpaceForPopup() {
- let id = this._parentView.connect('space-ready', Lang.bind(this,
- function() {
- this._parentView.disconnect(id);
- this._popup.popup();
- this._updatePopupPosition();
- }));
+ let id = this._parentView.connect('space-ready', () => {
+ this._parentView.disconnect(id);
+ this._popup.popup();
+ this._updatePopupPosition();
+ });
this._parentView.openSpaceForPopup(this, this._boxPointerArrowside, this.view.nRowsDisplayedAtOnce());
},
if (!this._popup) {
this._popup = new AppFolderPopup(this, this._boxPointerArrowside);
this._parentView.addFolderPopup(this._popup);
- this._popup.connect('open-state-changed', Lang.bind(this,
- function(popup, isOpen) {
- if (!isOpen)
- this.actor.checked = false;
- }));
+ this._popup.connect('open-state-changed', (popup, isOpen) => {
+ if (!isOpen)
+ this.actor.checked = false;
+ });
} else {
this._popup.updateArrowSide(this._boxPointerArrowside);
}
global.focus_manager.add_group(this.actor);
- source.actor.connect('destroy', Lang.bind(this,
- function() {
- this.actor.destroy();
- }));
+ source.actor.connect('destroy', () => { this.actor.destroy(); });
this._grabHelper = new GrabHelper.GrabHelper(this.actor);
this._grabHelper.addActor(Main.layoutManager.overviewGroup);
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress));
this._view.actor.opacity = 0;
this._boxPointer.show(BoxPointer.PopupAnimation.FADE |
BoxPointer.PopupAnimation.SLIDE,
- Lang.bind(this,
- function() {
+ () => {
this._view.actor.opacity = 255;
this._view.animate(IconGrid.AnimationDirection.IN);
- }));
+ });
this.emit('open-state-changed', true);
},
if (isDraggable) {
this._draggable = DND.makeDraggable(this.actor);
- this._draggable.connect('drag-begin', Lang.bind(this,
- function () {
- this._removeMenuTimeout();
- Main.overview.beginItemDrag(this);
- }));
- this._draggable.connect('drag-cancelled', Lang.bind(this,
- function () {
- Main.overview.cancelledItemDrag(this);
- }));
- this._draggable.connect('drag-end', Lang.bind(this,
- function () {
- Main.overview.endItemDrag(this);
- }));
+ this._draggable.connect('drag-begin', () => {
+ this._removeMenuTimeout();
+ Main.overview.beginItemDrag(this);
+ });
+ this._draggable.connect('drag-cancelled', () => {
+ Main.overview.cancelledItemDrag(this);
+ });
+ this._draggable.connect('drag-end', () => {
+ Main.overview.endItemDrag(this);
+ });
}
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
this._menuTimeoutId = 0;
- this._stateChangedId = this.app.connect('notify::state', Lang.bind(this,
- function () {
- this._updateRunningStyle();
- }));
+ this._stateChangedId = this.app.connect('notify::state', () => {
+ this._updateRunningStyle();
+ });
this._updateRunningStyle();
},
_setPopupTimeout() {
this._removeMenuTimeout();
- this._menuTimeoutId = Mainloop.timeout_add(MENU_POPUP_TIMEOUT,
- Lang.bind(this, function() {
- this._menuTimeoutId = 0;
- this.popupMenu();
- return GLib.SOURCE_REMOVE;
- }));
+ this._menuTimeoutId = Mainloop.timeout_add(MENU_POPUP_TIMEOUT, () => {
+ this._menuTimeoutId = 0;
+ this.popupMenu();
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(this._menuTimeoutId, '[gnome-shell] this.popupMenu');
},
if (!this._menu) {
this._menu = new AppIconMenu(this);
- this._menu.connect('activate-window', Lang.bind(this, function (menu, window) {
+ this._menu.connect('activate-window', (menu, window) => {
this.activateWindow(window);
- }));
- this._menu.connect('open-state-changed', Lang.bind(this, function (menu, isPoppedUp) {
+ });
+ this._menu.connect('open-state-changed', (menu, isPoppedUp) => {
if (!isPoppedUp)
this._onMenuPoppedDown();
- }));
- let id = Main.overview.connect('hiding', Lang.bind(this, function () { this._menu.close(); }));
- this.actor.connect('destroy', function() {
+ });
+ let id = Main.overview.connect('hiding', () => {
+ this._menu.close();
+ });
+ this.actor.connect('destroy', () => {
Main.overview.disconnect(id);
});
_redisplay() {
this.removeAll();
- let windows = this._source.app.get_windows().filter(function(w) {
- return !w.skip_taskbar;
- });
+ let windows = this._source.app.get_windows().filter(
+ w => !w.skip_taskbar
+ );
// Display the app windows menu items and the separator between windows
// of the current desktop and other windows.
separatorShown = true;
}
let item = this._appendMenuItem(window.title);
- item.connect('activate', Lang.bind(this, function() {
+ item.connect('activate', () => {
this.emit('activate-window', window);
- }));
+ });
}
if (!this._source.app.is_window_backed()) {
if (this._source.app.can_open_new_window() &&
actions.indexOf('new-window') == -1) {
this._newWindowMenuItem = this._appendMenuItem(_("New Window"));
- this._newWindowMenuItem.connect('activate', Lang.bind(this, function() {
+ this._newWindowMenuItem.connect('activate', () => {
if (this._source.app.state == Shell.AppState.STOPPED)
this._source.animateLaunch();
this._source.app.open_new_window(-1);
this.emit('activate-window', null);
- }));
+ });
this._appendSeparator();
}
this._source.app.state == Shell.AppState.STOPPED &&
actions.indexOf('activate-discrete-gpu') == -1) {
this._onDiscreteGpuMenuItem = this._appendMenuItem(_("Launch using Dedicated Graphics Card"));
- this._onDiscreteGpuMenuItem.connect('activate', Lang.bind(this, function() {
+ this._onDiscreteGpuMenuItem.connect('activate', () => {
if (this._source.app.state == Shell.AppState.STOPPED)
this._source.animateLaunch();
this._source.app.launch(0, -1, true);
this.emit('activate-window', null);
- }));
+ });
}
for (let i = 0; i < actions.length; i++) {
let action = actions[i];
let item = this._appendMenuItem(appInfo.get_action_name(action));
- item.connect('activate', Lang.bind(this, function(emitter, event) {
+ item.connect('activate', (emitter, event) => {
this._source.app.launch_action(action, event.get_time(), -1);
this.emit('activate-window', null);
- }));
+ });
}
let canFavorite = global.settings.is_writable('favorite-apps');
if (isFavorite) {
let item = this._appendMenuItem(_("Remove from Favorites"));
- item.connect('activate', Lang.bind(this, function() {
+ item.connect('activate', () => {
let favs = AppFavorites.getAppFavorites();
favs.removeFavorite(this._source.app.get_id());
- }));
+ });
} else {
let item = this._appendMenuItem(_("Add to Favorites"));
- item.connect('activate', Lang.bind(this, function() {
+ item.connect('activate', () => {
let favs = AppFavorites.getAppFavorites();
favs.addFavorite(this._source.app.get_id());
- }));
+ });
}
}
if (Shell.AppSystem.get_default().lookup_app('org.gnome.Software.desktop')) {
this._appendSeparator();
let item = this._appendMenuItem(_("Show Details"));
- item.connect('activate', Lang.bind(this, function() {
+ item.connect('activate', () => {
let id = this._source.app.get_id();
let args = GLib.Variant.new('(ss)', [id, '']);
- Gio.DBus.get(Gio.BusType.SESSION, null,
- function(o, res) {
- let bus = Gio.DBus.get_finish(res);
- bus.call('org.gnome.Software',
- '/org/gnome/Software',
- 'org.gtk.Actions', 'Activate',
- GLib.Variant.new('(sava{sv})',
- ['details', [args], null]),
- null, 0, -1, null, null);
- Main.overview.hide();
- });
- }));
+ Gio.DBus.get(Gio.BusType.SESSION, null, (o, res) => {
+ let bus = Gio.DBus.get_finish(res);
+ bus.call('org.gnome.Software',
+ '/org/gnome/Software',
+ 'org.gtk.Actions', 'Activate',
+ GLib.Variant.new('(sava{sv})',
+ ['details', [args], null]),
+ null, 0, -1, null, null);
+ Main.overview.hide();
+ });
+ });
}
}
},
// Map old desktop file names to the current ones
let updated = false;
- ids = ids.map(function (id) {
+ ids = ids.map(id => {
let newId = RENAMED_DESKTOP_IDS[id];
if (newId !== undefined &&
appSys.lookup_app(newId) != null) {
if (updated)
global.settings.set_strv(this.FAVORITE_APPS_KEY, ids);
- let apps = ids.map(function (id) {
- return appSys.lookup_app(id);
- }).filter(function (app) {
- return app != null;
- });
+ let apps = ids.map(id => appSys.lookup_app(id))
+ .filter(app => app != null);
this._favorites = {};
for (let i = 0; i < apps.length; i++) {
let app = apps[i];
Main.overview.setMessage(_("%s has been added to your favorites.").format(app.get_name()),
{ forFeedback: true,
- undoCallback: Lang.bind(this, function () {
- this._removeFavorite(appId);
- })
+ undoCallback: () => {
+ this._removeFavorite(appId);
+ }
});
},
if (!appId in this._favorites)
return false;
- let ids = this._getIds().filter(function (id) { return id != appId; });
+ let ids = this._getIds().filter(id => id != appId);
global.settings.set_strv(this.FAVORITE_APPS_KEY, ids);
return true;
},
Main.overview.setMessage(_("%s has been removed from your favorites.").format(app.get_name()),
{ forFeedback: true,
- undoCallback: Lang.bind(this, function () {
- this._addFavorite(appId, pos);
- })
+ undoCallback: () => {
+ this._addFavorite(appId, pos);
+ }
});
}
});
_addDevice(device) {
let box = new St.BoxLayout({ style_class: 'audio-selection-device-box',
vertical: true });
- box.connect('notify::height',
- function() {
- Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
- function() {
- box.width = box.height;
- });
+ box.connect('notify::height', () => {
+ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
+ box.width = box.height;
});
+ });
let icon = new St.Icon({ style_class: 'audio-selection-device-icon',
icon_name: this._getDeviceIcon(device) });
child: box });
this._selectionBox.add(button);
- button.connect('clicked', Lang.bind(this,
- function() {
- this.emit('device-selected', device);
- this.close();
- Main.overview.hide();
- }));
+ button.connect('clicked', () => {
+ this.emit('device-selected', device);
+ this.close();
+ Main.overview.hide();
+ });
},
_openSettings() {
let connection = this._dbusImpl.get_connection();
let info = this._dbusImpl.get_info();
let deviceName = Object.keys(AudioDevice).filter(
- function(dev) {
- return AudioDevice[dev] == device;
- })[0].toLowerCase();
+ dev => AudioDevice[dev] == device
+ )[0].toLowerCase();
connection.emit_signal(this._audioSelectionDialog._sender,
this._dbusImpl.get_object_path(),
info ? info.name : null,
let [deviceNames] = params;
let devices = 0;
- deviceNames.forEach(function(n) {
- devices |= AudioDevice[n.toUpperCase()];
- });
+ deviceNames.forEach(n => { devices |= AudioDevice[n.toUpperCase()]; });
let dialog;
try {
let monitor = file.monitor(Gio.FileMonitorFlags.NONE, null);
monitor.connect('changed',
- Lang.bind(this, function(obj, file, otherFile, eventType) {
+ (obj, file, otherFile, eventType) => {
// Ignore CHANGED and CREATED events, since in both cases
// we'll get a CHANGES_DONE_HINT event when done.
if (eventType != Gio.FileMonitorEvent.CHANGED &&
eventType != Gio.FileMonitorEvent.CREATED)
this.emit('file-changed', file);
- }));
+ });
this._fileMonitors[key] = monitor;
},
let animation = this._animations[params.settingsSchema];
if (animation && _fileEqual0(animation.file, params.file)) {
if (params.onLoaded) {
- let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() {
+ let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
params.onLoaded(this._animations[params.settingsSchema]);
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded');
}
return;
animation = new Animation({ file: params.file });
- animation.load(Lang.bind(this, function() {
- this._animations[params.settingsSchema] = animation;
+ animation.load(() => {
+ this._animations[params.settingsSchema] = animation;
- if (params.onLoaded) {
- let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() {
- params.onLoaded(this._animations[params.settingsSchema]);
- return GLib.SOURCE_REMOVE;
- }));
- GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded');
- }
- }));
+ if (params.onLoaded) {
+ let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
+ params.onLoaded(this._animations[params.settingsSchema]);
+ return GLib.SOURCE_REMOVE;
+ });
+ GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded');
+ }
+ });
},
getBackgroundSource(layoutManager, settingsSchema) {
this._clock = new GnomeDesktop.WallClock();
this._timezoneChangedId = this._clock.connect('notify::timezone',
- Lang.bind(this, function() {
+ () => {
if (this._animation)
this._loadAnimation(this._animation.file);
- }));
+ });
let loginManager = LoginManager.getLoginManager();
this._prepareForSleepId = loginManager.connect('prepare-for-sleep',
this._refreshAnimation();
});
- this._settingsChangedSignalId = this._settings.connect('changed', Lang.bind(this, function() {
- this.emit('changed');
- }));
+ this._settingsChangedSignalId = this._settings.connect('changed', () => {
+ this.emit('changed');
+ });
this._load();
},
this.isLoaded = true;
- let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() {
+ let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
this.emit('loaded');
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(id, '[gnome-shell] this.emit');
},
this._cache.monitorFile(file);
let signalId = this._cache.connect('file-changed',
- Lang.bind(this, function(cache, changedFile) {
+ (cache, changedFile) => {
if (changedFile.equal(file)) {
let imageCache = Meta.BackgroundImageCache.get_default();
imageCache.purge(changedFile);
this.emit('changed');
}
- }));
+ });
this._fileWatches[key] = signalId;
},
this._animation.update(this._layoutManager.monitors[this._monitorIndex]);
let files = this._animation.keyFrameFiles;
- let finish = Lang.bind(this, function() {
+ let finish = () => {
this._setLoaded();
if (files.length > 1) {
this.background.set_blend(files[0], files[1],
this.background.set_file(null, this._style);
}
this._queueUpdateAnimation();
- });
+ };
let cache = Meta.BackgroundImageCache.get_default();
let numPendingImages = files.length;
if (numPendingImages == 0)
finish();
} else {
- let id = image.connect('loaded',
- Lang.bind(this, function() {
- image.disconnect(id);
- numPendingImages--;
- if (numPendingImages == 0)
- finish();
- }));
+ let id = image.connect('loaded', () => {
+ image.disconnect(id);
+ numPendingImages--;
+ if (numPendingImages == 0)
+ finish();
+ });
}
}
},
this._updateAnimationTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
interval,
- Lang.bind(this, function() {
- this._updateAnimationTimeoutId = 0;
- this._updateAnimation();
- return GLib.SOURCE_REMOVE;
- }));
+ () => {
+ this._updateAnimationTimeoutId = 0;
+ this._updateAnimation();
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(this._updateAnimationTimeoutId, '[gnome-shell] this._updateAnimation');
},
_loadAnimation(file) {
this._cache.getAnimation({ file: file,
settingsSchema: this._settings.schema_id,
- onLoaded: Lang.bind(this, function(animation) {
+ onLoaded: animation => {
this._animation = animation;
if (!this._animation || this._cancellable.is_cancelled()) {
this._updateAnimation();
this._watchFile(file);
- })
+ }
});
},
if (image.is_loaded())
this._setLoaded();
else {
- let id = image.connect('loaded',
- Lang.bind(this, function() {
- this._setLoaded();
- image.disconnect(id);
- }));
+ let id = image.connect('loaded', () => {
+ this._setLoaded();
+ image.disconnect(id);
+ });
}
},
let image = cache.load(file);
if (image.is_loaded()) {
image = null;
- let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() {
+ let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
this.emit('loaded');
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(id, '[gnome-shell] SystemBackground.loaded');
} else {
- let id = image.connect('loaded',
- Lang.bind(this, function() {
- this.emit('loaded');
- image.disconnect(id);
- image = null;
- }));
+ let id = image.connect('loaded', () => {
+ this.emit('loaded');
+ image.disconnect(id);
+ image = null;
+ });
}
},
});
style: style
});
- background._changedId = background.connect('changed', Lang.bind(this, function() {
+ background._changedId = background.connect('changed', () => {
background.disconnect(background._changedId);
background.destroy();
delete this._backgrounds[monitorIndex];
- }));
+ });
this._backgrounds[monitorIndex] = background;
}
load(callback) {
this._show = new GnomeDesktop.BGSlideShow({ filename: this.file.get_path() });
- this._show.load_async(null,
- Lang.bind(this,
- function(object, result) {
- this.loaded = true;
- if (callback)
- callback();
- }));
+ this._show.load_async(null, (object, result) => {
+ this.loaded = true;
+ if (callback)
+ callback();
+ });
},
update(monitor) {
this._swapBackgroundActor();
} else {
newBackgroundActor.loadedSignalId = background.connect('loaded',
- Lang.bind(this, function() {
+ () => {
background.disconnect(newBackgroundActor.loadedSignalId);
newBackgroundActor.loadedSignalId = 0;
this._swapBackgroundActor();
-
- }));
+ });
}
},
backgroundActor.lower_bottom();
}
- let changeSignalId = background.connect('changed', Lang.bind(this, function() {
+ let changeSignalId = background.connect('changed', () => {
background.disconnect(changeSignalId);
changeSignalId = null;
this._updateBackgroundActor();
- }));
+ });
- backgroundActor.connect('destroy', Lang.bind(this, function() {
+ backgroundActor.connect('destroy', () => {
if (changeSignalId)
background.disconnect(changeSignalId);
if (backgroundActor.loadedSignalId)
background.disconnect(backgroundActor.loadedSignalId);
- }));
+ });
return backgroundActor;
},
}
let clickAction = new Clutter.ClickAction();
- clickAction.connect('long-press', function(action, actor, state) {
+ clickAction.connect('long-press', (action, actor, state) => {
if (state == Clutter.LongPressState.QUERY)
return ((action.get_button() == 0 ||
action.get_button() == 1) &&
}
return true;
});
- clickAction.connect('clicked', function(action) {
+ clickAction.connect('clicked', action => {
if (action.get_button() == 3) {
let [x, y] = action.get_coords();
openMenu(x, y);
});
actor.add_action(clickAction);
- let grabOpBeginId = global.display.connect('grab-op-begin', function () {
+ let grabOpBeginId = global.display.connect('grab-op-begin', () => {
clickAction.release();
});
- actor.connect('destroy', function() {
+ actor.connect('destroy', () => {
actor._backgroundMenu.destroy();
actor._backgroundMenu = null;
actor._backgroundManager = null;
_muteInput() {
if (this._capturedEventId == 0)
this._capturedEventId = this.actor.connect('captured-event',
- function() { return Clutter.EVENT_STOP; });
+ () => Clutter.EVENT_STOP);
},
_unmuteInput() {
xOffset: 0,
yOffset: 0,
transition: 'linear',
- onComplete: Lang.bind(this, function() {
+ onComplete: () => {
this._unmuteInput();
if (onComplete)
onComplete();
- }),
+ },
time: animationTime });
},
yOffset: yOffset,
transition: 'linear',
time: animationTime,
- onComplete: Lang.bind(this, function () {
+ onComplete: () => {
this.actor.hide();
this.opacity = 0;
this.xOffset = 0;
this.yOffset = 0;
if (onComplete)
onComplete();
- })
+ }
});
},
if (this._arrowSide != arrowSide) {
this._arrowSide = arrowSide;
this._reposition();
- Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
+ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._container.queue_relayout();
return false;
- }));
+ });
this.emit('arrow-side-changed');
}
var MESSAGE_ICON_SIZE = -1; // pick up from CSS
-var NC_ = function(context, str) { return context + '\u0004' + str; };
+var NC_ = (context, str) => context + '\u0004' + str;
function sameYear(dateA, dateB) {
return (dateA.getYear() == dateB.getYear());
let savedState = global.get_persistent_state('as', 'ignored_events');
if (savedState)
- savedState.deep_unpack().forEach(Lang.bind(this,
- function(eventId) {
- this._ignoredEvents.set(eventId, true);
- }));
+ savedState.deep_unpack().forEach(eventId => {
+ this._ignoredEvents.set(eventId, true);
+ });
this._initialized = false;
this._dbusProxy = new CalendarServer();
- this._dbusProxy.init_async(GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(object, result) {
+ this._dbusProxy.init_async(GLib.PRIORITY_DEFAULT, null, (object, result) => {
let loaded = false;
try {
this._dbusProxy.connectSignal('Changed', Lang.bind(this, this._onChanged));
- this._dbusProxy.connect('notify::g-name-owner', Lang.bind(this, function() {
+ this._dbusProxy.connect('notify::g-name-owner', () => {
if (this._dbusProxy.g_name_owner)
this._onNameAppeared();
else
this._onNameVanished();
- }));
+ });
- this._dbusProxy.connect('g-properties-changed', Lang.bind(this, function() {
+ this._dbusProxy.connect('g-properties-changed', () => {
this.emit('notify::has-calendars');
- }));
+ });
this._initialized = loaded;
if (loaded) {
this.emit('notify::has-calendars');
this._onNameAppeared();
}
- }));
+ });
},
destroy() {
let event = new CalendarEvent(id, date, end, summary, allDay);
newEvents.push(event);
}
- newEvents.sort(function(event1, event2) {
- return event1.date.getTime() - event2.date.getTime();
- });
+ newEvents.sort((ev1, ev2) => ev1.date.getTime() - ev2.date.getTime());
}
this._events = newEvents;
result.push(event);
}
}
- result.sort(function(event1, event2) {
+ result.sort((event1, event2) => {
// sort events by end time on ending day
let d1 = event1.date < begin && event1.end <= end ? event1.end : event1.date;
let d2 = event2.date < begin && event2.end <= end ? event2.end : event2.date;
// requestRange(), getEvents(), hasEvents() methods and the ::changed signal.
setEventSource(eventSource) {
this._eventSource = eventSource;
- this._eventSource.connect('changed', Lang.bind(this, function() {
+ this._eventSource.connect('changed', () => {
this._rebuildCalendar();
this._update();
- }));
+ });
this._rebuildCalendar();
this._update();
},
button.reactive = false;
button._date = new Date(iter);
- button.connect('clicked', Lang.bind(this, function() {
+ button.connect('clicked', () => {
this._shouldDateGrabFocus = true;
this.setDate(button._date);
this._shouldDateGrabFocus = false;
- }));
+ });
let hasEvents = this._eventSource.hasEvents(iter);
let styleClass = 'calendar-day-base calendar-day';
if (!this._calendarBegin || !sameMonth(this._selectedDate, this._calendarBegin) || !sameDay(now, this._markedAsToday))
this._rebuildCalendar();
- this._buttons.forEach(Lang.bind(this, function(button) {
+ this._buttons.forEach(button => {
if (sameDay(button._date, this._selectedDate)) {
button.add_style_pseudo_class('selected');
if (this._shouldDateGrabFocus)
}
else
button.remove_style_pseudo_class('selected');
- }));
+ });
}
});
Signals.addSignalMethods(Calendar.prototype);
this.setIcon(this._getIcon());
- this.connect('close', Lang.bind(this,
- function() {
- this._closed = true;
- this.notification.destroy(MessageTray.NotificationDestroyedReason.DISMISSED);
- }));
- this._destroyId = notification.connect('destroy', Lang.bind(this,
- function() {
- if (!this._closed)
- this.close();
- }));
+ this.connect('close', () => {
+ this._closed = true;
+ this.notification.destroy(MessageTray.NotificationDestroyedReason.DISMISSED);
+ });
+ this._destroyId = notification.connect('destroy', () => {
+ if (!this._closed)
+ this.close();
+ });
this._updatedId = notification.connect('updated',
Lang.bind(this, this._onUpdated));
},
let event = events[i];
let message = new EventMessage(event, this._date);
- message.connect('close', Lang.bind(this, function() {
+ message.connect('close', () => {
this._ignoreEvent(event);
- }));
+ });
this.addMessage(message, false);
}
let apps = Gio.AppInfo.get_recommended_for_type('text/calendar');
if (apps && (apps.length > 0)) {
let app = Gio.AppInfo.get_default_for_type('text/calendar', false);
- let defaultInRecommended = apps.some(function(a) { return a.equal(app); });
+ let defaultInRecommended = apps.some(a => a.equal(app));
this._calendarApp = defaultInRecommended ? app : apps[0];
} else {
this._calendarApp = null;
this._nUrgent = 0;
Main.messageTray.connect('source-added', Lang.bind(this, this._sourceAdded));
- Main.messageTray.getSources().forEach(Lang.bind(this, function(source) {
+ Main.messageTray.getSources().forEach(source => {
this._sourceAdded(Main.messageTray, source);
- }));
+ });
this.actor.connect('notify::mapped', Lang.bind(this, this._onMapped));
},
notificationAddedId: 0,
};
- obj.destroyId = source.connect('destroy', Lang.bind(this, function(source) {
+ obj.destroyId = source.connect('destroy', source => {
this._onSourceDestroy(source, obj);
- }));
+ });
obj.notificationAddedId = source.connect('notification-added',
Lang.bind(this, this._onNotificationAdded));
let isUrgent = notification.urgency == MessageTray.Urgency.CRITICAL;
- let updatedId = notification.connect('updated', Lang.bind(this,
- function() {
- message.setSecondaryActor(this._createTimeLabel(notification.datetime));
- this.moveMessage(message, isUrgent ? 0 : this._nUrgent, this.actor.mapped);
- }));
- let destroyId = notification.connect('destroy', Lang.bind(this,
- function() {
- notification.disconnect(destroyId);
- notification.disconnect(updatedId);
- if (isUrgent)
- this._nUrgent--;
- }));
+ let updatedId = notification.connect('updated', () => {
+ message.setSecondaryActor(this._createTimeLabel(notification.datetime));
+ this.moveMessage(message, isUrgent ? 0 : this._nUrgent, this.actor.mapped);
+ });
+ let destroyId = notification.connect('destroy', () => {
+ notification.disconnect(destroyId);
+ notification.disconnect(updatedId);
+ if (isUrgent)
+ this._nUrgent--;
+ });
if (isUrgent) {
// Keep track of urgent notifications to keep them on top
canClearChangedId: 0,
keyFocusId: 0
};
- obj.destroyId = section.actor.connect('destroy', Lang.bind(this,
- function() {
- this._removeSection(section);
- }));
+ obj.destroyId = section.actor.connect('destroy', () => {
+ this._removeSection(section);
+ });
obj.visibleId = section.actor.connect('notify::visible',
Lang.bind(this, this._sync));
obj.emptyChangedId = section.connect('empty-changed',
_sync() {
let sections = [...this._sections.keys()];
- let visible = sections.some(function(s) {
- return s.allowed;
- });
+ let visible = sections.some(s => s.allowed);
this.actor.visible = visible;
if (!visible)
return;
- let empty = sections.every(function(s) {
- return s.empty || !s.actor.visible;
- });
+ let empty = sections.every(s => s.empty || !s.actor.visible);
this._placeholder.actor.visible = empty;
this._clearButton.visible = !empty;
- let canClear = sections.some(function(s) {
- return s.canClear && s.actor.visible;
- });
+ let canClear = sections.some(s => s.canClear && s.actor.visible);
this._clearButton.reactive = canClear;
},
{ scale_y: 1,
transition: 'linear',
time: DIALOG_TRANSITION_TIME,
- onComplete: Lang.bind(this, function () {
+ onComplete: () => {
Main.layoutManager.trackChrome(this._dialog, { affectsInputRegion: true });
- })
+ }
});
},
{ scale_y: 0,
transition: 'linear',
time: DIALOG_TRANSITION_TIME,
- onComplete: Lang.bind(this, function () {
+ onComplete: () => {
dialog.destroy();
- })
+ }
});
},
_sessionUpdated() {
let newEnabledComponents = Main.sessionMode.components;
- newEnabledComponents.filter(Lang.bind(this, function(name) {
- return this._enabledComponents.indexOf(name) == -1;
- })).forEach(Lang.bind(this, function(name) {
+ newEnabledComponents.filter(
+ name => this._enabledComponents.indexOf(name) == -1
+ ).forEach(name => {
this._enableComponent(name);
- }));
+ });
- this._enabledComponents.filter(Lang.bind(this, function(name) {
- return newEnabledComponents.indexOf(name) == -1;
- })).forEach(Lang.bind(this, function(name) {
+ this._enabledComponents.filter(
+ name => newEnabledComponents.indexOf(name) == -1
+ ).forEach(name => {
this._disableComponent(name);
- }));
+ });
this._enabledComponents = newEnabledComponents;
},
_InhibitorsChanged(object, senderName, [inhibtor]) {
this._session.IsInhibitedRemote(GNOME_SESSION_AUTOMOUNT_INHIBIT,
- Lang.bind(this,
- function(result, error) {
- if (!error) {
- this._inhibited = result[0];
- }
- }));
+ (result, error) => {
+ if (!error) {
+ this._inhibited = result[0];
+ }
+ });
},
_startupMountAll() {
let volumes = this._volumeMonitor.get_volumes();
- volumes.forEach(Lang.bind(this, function(volume) {
+ volumes.forEach(volume => {
this._checkAndMountVolume(volume, { checkSession: false,
useMountOp: false,
allowAutorun: false });
- }));
+ });
this._mountAllId = 0;
return GLib.SOURCE_REMOVE;
if (drive.can_stop()) {
drive.stop
(Gio.MountUnmountFlags.FORCE, null, null,
- Lang.bind(this, function(drive, res) {
+ (drive, res) => {
try {
drive.stop_finish(res);
} catch (e) {
log("Unable to stop the drive after drive-eject-button " + e.toString());
}
- }));
+ });
} else if (drive.can_eject()) {
drive.eject_with_operation
(Gio.MountUnmountFlags.FORCE, null, null,
- Lang.bind(this, function(drive, res) {
+ (drive, res) => {
try {
drive.eject_with_operation_finish(res);
} catch (e) {
log("Unable to eject the drive after drive-eject-button " + e.toString());
}
- }));
+ });
}
},
_onVolumeRemoved(monitor, volume) {
this._volumeQueue =
- this._volumeQueue.filter(function(element) {
- return (element != volume);
- });
+ this._volumeQueue.filter(element => (element != volume));
},
_reaskPassword(volume) {
},
_allowAutorunExpire(volume) {
- let id = Mainloop.timeout_add_seconds(AUTORUN_EXPIRE_TIMEOUT_SECS, function() {
+ let id = Mainloop.timeout_add_seconds(AUTORUN_EXPIRE_TIMEOUT_SECS, () => {
volume.allowAutorun = false;
return GLib.SOURCE_REMOVE;
});
let hotplugSniffer = new HotplugSniffer();
hotplugSniffer.SniffURIRemote(root.get_uri(),
- Lang.bind(this, function([contentTypes]) {
+ ([contentTypes]) => {
this._emitCallback(mount, contentTypes);
- }));
+ });
}
},
contentTypes = [];
// we're not interested in win32 software content types here
- contentTypes = contentTypes.filter(function(type) {
- return (type != 'x-content/win32-software');
- });
+ contentTypes = contentTypes.filter(
+ type => (type != 'x-content/win32-software')
+ );
let apps = [];
- contentTypes.forEach(function(type) {
+ contentTypes.forEach(type => {
let app = Gio.app_info_get_default_for_type(type, false);
if (app)
if (!this._session.SessionIsActive)
return;
- let discoverer = new ContentTypeDiscoverer(Lang.bind(this, function(mount, apps, contentTypes) {
+ let discoverer = new ContentTypeDiscoverer((mount, apps, contentTypes) => {
this._dispatcher.addMount(mount, apps, contentTypes);
- }));
+ });
discoverer.guessContentTypes(mount);
},
},
_getSourceForMount(mount) {
- let filtered =
- this._sources.filter(function (source) {
- return (source.mount == mount);
- });
+ let filtered = this._sources.filter(source => (source.mount == mount));
// we always make sure not to add two sources for the same
// mount in addMount(), so it's safe to assume filtered.length
createBanner() {
let banner = new MessageTray.NotificationBanner(this);
- this.source.apps.forEach(Lang.bind(this, function (app) {
+ this.source.apps.forEach(app => {
let actor = this._buttonForApp(app);
if (actor)
banner.addButton(actor);
- }));
+ });
return banner;
},
button_mask: St.ButtonMask.ONE,
style_class: 'hotplug-notification-item button' });
- button.connect('clicked', Lang.bind(this, function() {
+ button.connect('clicked', () => {
startAppForMount(app, this._mount);
this.destroy();
- }));
+ });
return button;
},
_init() {
this._prompter = new Gcr.SystemPrompter();
- this._prompter.connect('new-prompt', Lang.bind(this,
- function() {
- let dialog = this._enabled ? new KeyringDialog()
- : new KeyringDummyDialog();
- this._currentPrompt = dialog.prompt;
- return this._currentPrompt;
- }));
+ this._prompter.connect('new-prompt', () => {
+ let dialog = this._enabled ? new KeyringDialog()
+ : new KeyringDummyDialog();
+ this._currentPrompt = dialog.prompt;
+ return this._currentPrompt;
+ });
this._dbusId = null;
this._registered = false;
this._enabled = false;
}
secret.entry.clutter_text.connect('activate', Lang.bind(this, this._onOk));
- secret.entry.clutter_text.connect('text-changed', Lang.bind(this, function() {
+ secret.entry.clutter_text.connect('text-changed', () => {
secret.value = secret.entry.get_text();
if (secret.validate)
secret.valid = secret.validate(secret);
else
secret.valid = secret.value.length > 0;
this._updateOkButton();
- }));
+ });
} else
secret.valid = true;
},
_readStdoutOldStyle() {
- this._dataStdout.read_line_async(GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(stream, result) {
+ this._dataStdout.read_line_async(GLib.PRIORITY_DEFAULT, null, (stream, result) => {
let [line, len] = this._dataStdout.read_line_finish_utf8(result);
if (line == null) {
// try to read more!
this._readStdoutOldStyle();
- }));
+ });
},
_readStdoutNewStyle() {
- this._dataStdout.fill_async(-1, GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(stream, result) {
+ this._dataStdout.fill_async(-1, GLib.PRIORITY_DEFAULT, null, (stream, result) => {
let cnt = this._dataStdout.fill_finish(result);
if (cnt == 0) {
// Try to read more
this._dataStdout.set_buffer_size(2 * this._dataStdout.get_buffer_size());
this._readStdoutNewStyle();
- }));
+ });
},
_showNewStyleDialog() {
let vpnSetting = this._connection.get_setting_vpn();
try {
- vpnSetting.foreach_data_item(Lang.bind(this, function(key, value) {
+ vpnSetting.foreach_data_item((key, value) => {
this._stdin.write('DATA_KEY=' + key + '\n', null);
this._stdin.write('DATA_VAL=' + (value || '') + '\n\n', null);
- }));
- vpnSetting.foreach_secret(Lang.bind(this, function(key, value) {
+ });
+ vpnSetting.foreach_secret((key, value) => {
this._stdin.write('SECRET_KEY=' + key + '\n', null);
this._stdin.write('SECRET_VAL=' + (value || '') + '\n\n', null);
- }));
+ });
this._stdin.write('DONE\n\n', null);
} catch(e) {
logError(e, 'internal error while writing connection to helper');
let notification = new MessageTray.Notification(source, title, body);
- notification.connect('activated', Lang.bind(this, function() {
+ notification.connect('activated', () => {
notification.answered = true;
this._handleRequest(requestId, connection, settingName, hints, flags);
- }));
+ });
this._notifications[requestId] = notification;
- notification.connect('destroy', Lang.bind(this, function() {
+ notification.connect('destroy', () => {
if (!notification.answered)
this._native.respond(requestId, Shell.NetworkAgentResponse.USER_CANCELED);
delete this._notifications[requestId];
- }));
+ });
Main.messageTray.add(source);
source.notify(notification);
}
let dialog = new NetworkSecretDialog(this._native, requestId, connection, settingName, hints);
- dialog.connect('destroy', Lang.bind(this, function() {
+ dialog.connect('destroy', () => {
delete this._dialogs[requestId];
- }));
+ });
this._dialogs[requestId] = dialog;
dialog.open(global.get_current_time());
},
}
let vpnRequest = new VPNRequestHandler(this._native, requestId, binary, serviceType, connection, hints, flags);
- vpnRequest.connect('destroy', Lang.bind(this, function() {
+ vpnRequest.connect('destroy', () => {
delete this._vpnRequests[requestId];
- }));
+ });
this._vpnRequests[requestId] = vpnRequest;
},
RECEIVED: 'chat-received'
};
-var N_ = function(s) { return s; };
+var N_ = s => s;
function makeMessageFromTpMessage(tpMessage, direction) {
let [text, flags] = tpMessage.to_text();
let source = new ChatSource(account, conn, channel, contact, this);
this._chatSources[channel.get_object_path()] = source;
- source.connect('destroy', Lang.bind(this,
- function() {
- delete this._chatSources[channel.get_object_path()];
- }));
+ source.connect('destroy', () => {
+ delete this._chatSources[channel.get_object_path()];
+ });
},
vfunc_handle_channels(account, conn, channels, requests,
}
// Approve private text channels right away as we are going to handle it
- dispatchOp.claim_with_async(this, Lang.bind(this, function(dispatchOp, result) {
+ dispatchOp.claim_with_async(this, (dispatchOp, result) => {
try {
dispatchOp.claim_with_finish(result);
this._handlingChannels(account, conn, [channel], false);
} catch (err) {
log('Failed to Claim channel: ' + err);
}
- }));
+ });
context.accept();
},
this._notification = new ChatNotification(this);
this._notification.connect('activated', Lang.bind(this, this.open));
- this._notification.connect('updated', Lang.bind(this,
- function() {
- if (this._banner && this._banner.expanded)
- this._ackMessages();
- }));
- this._notification.connect('destroy', Lang.bind(this,
- function() {
- this._notification = null;
- }));
+ this._notification.connect('updated', () => {
+ if (this._banner && this._banner.expanded)
+ this._ackMessages();
+ });
+ this._notification.connect('destroy', () => {
+ this._notification = null;
+ });
this.pushNotification(this._notification);
},
// We ack messages when the user expands the new notification
let id = this._banner.connect('expanded', Lang.bind(this, this._ackMessages));
- this._banner.actor.connect('destroy', Lang.bind(this,
- function() {
- this._banner.disconnect(id);
- this._banner = null;
- }));
+ this._banner.actor.connect('destroy', () => {
+ this._banner.disconnect(id);
+ this._banner = null;
+ });
return this._banner;
},
this._ackMessages();
// The chat box has been destroyed so it can't
// handle the channel any more.
- this._channel.close_async(function(channel, result) {
+ this._channel.close_async((channel, result) => {
channel.close_finish(result);
});
} else {
}
let msg = Tp.ClientMessage.new_text(type, text);
- this._channel.send_message_async(msg, 0, Lang.bind(this, function (src, result) {
+ this._channel.send_message_async(msg, 0, (src, result) => {
this._channel.send_message_finish(result);
- }));
+ });
},
setChatState(state) {
let maxLength = (lastMessageTime < currentTime - SCROLLBACK_RECENT_TIME) ?
SCROLLBACK_IDLE_LENGTH : SCROLLBACK_RECENT_LENGTH;
- let filteredHistory = this.messages.filter(function(item) { return item.realMessage });
+ let filteredHistory = this.messages.filter(item => item.realMessage);
if (filteredHistory.length > maxLength) {
let lastMessageToKeep = filteredHistory[maxLength];
let expired = this.messages.splice(this.messages.indexOf(lastMessageToKeep));
this._responseEntry.clutter_text.connect('text-changed', Lang.bind(this, this._onEntryChanged));
this.setActionArea(this._responseEntry);
- this._responseEntry.clutter_text.connect('key-focus-in', Lang.bind(this, function() {
+ this._responseEntry.clutter_text.connect('key-focus-in', () => {
this.focused = true;
- }));
- this._responseEntry.clutter_text.connect('key-focus-out', Lang.bind(this, function() {
+ });
+ this._responseEntry.clutter_text.connect('key-focus-out', () => {
this.focused = false;
this.emit('unfocused');
- }));
+ });
this._scrollArea = new St.ScrollView({ style_class: 'chat-scrollview vfade',
vscrollbar_policy: Gtk.PolicyType.AUTOMATIC,
// force a scroll to the bottom if things change while we were at the
// bottom
this._oldMaxScrollValue = this._scrollArea.vscroll.adjustment.value;
- this._scrollArea.vscroll.adjustment.connect('changed', Lang.bind(this, function(adjustment) {
+ this._scrollArea.vscroll.adjustment.connect('changed', adjustment => {
if (adjustment.value == this._oldMaxScrollValue)
this.scrollTo(St.Side.BOTTOM);
this._oldMaxScrollValue = Math.max(adjustment.lower, adjustment.upper - adjustment.page_size);
- }));
+ });
this._inputHistory = new History.HistoryManager({ entry: this._responseEntry.clutter_text });
this._messageActors = new Map();
this._messageAddedId = this.notification.connect('message-added',
- Lang.bind(this, function(n, message) {
+ (n, message) => {
this._addMessage(message);
- }));
+ });
this._messageRemovedId = this.notification.connect('message-removed',
- Lang.bind(this, function(n, message) {
+ (n, message) => {
let actor = this._messageActors.get(message);
if (this._messageActors.delete(message))
actor.destroy();
- }));
+ });
this._timestampChangedId = this.notification.connect('timestamp-changed',
- Lang.bind(this, function(n, message) {
+ (n, message) => {
this._updateTimestamp(message);
- }));
+ });
for (let i = this.notification.messages.length - 1; i >= 0; i--)
this._addMessage(this.notification.messages[i]);
item.iconName = icon;
this._items.push(item);
- root.connect('destroy', Lang.bind(this, function() { this.removeGroup(root); }));
+ root.connect('destroy', () => { this.removeGroup(root); });
if (root instanceof St.Widget)
global.focus_manager.add_group(root);
},
popup(backward, binding, mask) {
// Start with the set of focus groups that are currently mapped
- let items = this._items.filter(function (item) { return item.proxy.mapped; });
+ let items = this._items.filter(item => item.proxy.mapped);
// And add the windows metacity would show in its Ctrl-Alt-Tab list
if (Main.sessionMode.hasWindows && !Main.overview.visible) {
this._popup.show(backward, binding, mask);
this._popup.actor.connect('destroy',
- Lang.bind(this, function() {
+ () => {
this._popup = null;
- }));
+ });
}
},
{ opacity: 0,
time: DASH_ITEM_LABEL_HIDE_TIME,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this, function() {
+ onComplete: () => {
this.label.hide();
- })
+ }
});
},
childOpacity: 0,
time: DASH_ANIMATION_TIME,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this, function() {
+ onComplete: () => {
this.destroy();
- })
+ }
});
},
let id = app.get_id();
- Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
- function () {
- AppFavorites.getAppFavorites().removeFavorite(id);
- return false;
- }));
+ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
+ AppFavorites.getAppFavorites().removeFavorite(id);
+ return false;
+ });
return true;
}
this._container.add_actor(this._showAppsIcon);
this.actor = new St.Bin({ child: this._container });
- this.actor.connect('notify::height', Lang.bind(this,
- function() {
- if (this._maxHeight != this.actor.height)
- this._queueRedisplay();
- this._maxHeight = this.actor.height;
- }));
+ this.actor.connect('notify::height', () => {
+ if (this._maxHeight != this.actor.height)
+ this._queueRedisplay();
+ this._maxHeight = this.actor.height;
+ });
this._workId = Main.initializeDeferredWork(this._box, Lang.bind(this, this._redisplay));
this._appSystem = Shell.AppSystem.get_default();
- this._appSystem.connect('installed-changed', Lang.bind(this, function() {
+ this._appSystem.connect('installed-changed', () => {
AppFavorites.getAppFavorites().reload();
this._queueRedisplay();
- }));
+ });
AppFavorites.getAppFavorites().connect('changed', Lang.bind(this, this._queueRedisplay));
this._appSystem.connect('app-state-changed', Lang.bind(this, this._queueRedisplay));
},
_hookUpLabel(item, appIcon) {
- item.child.connect('notify::hover', Lang.bind(this, function() {
+ item.child.connect('notify::hover', () => {
this._syncLabel(item, appIcon);
- }));
+ });
- let id = Main.overview.connect('hiding', Lang.bind(this, function() {
+ let id = Main.overview.connect('hiding', () => {
this._labelShowing = false;
item.hideLabel();
- }));
- item.child.connect('destroy', function() {
+ });
+ item.child.connect('destroy', () => {
Main.overview.disconnect(id);
});
if (appIcon) {
- appIcon.connect('sync-tooltip', Lang.bind(this, function() {
+ appIcon.connect('sync-tooltip', () => {
this._syncLabel(item, appIcon);
- }));
+ });
}
},
showLabel: false });
if (appIcon._draggable) {
appIcon._draggable.connect('drag-begin',
- Lang.bind(this, function() {
+ () => {
appIcon.actor.opacity = 50;
- }));
+ });
appIcon._draggable.connect('drag-end',
- Lang.bind(this, function() {
+ () => {
appIcon.actor.opacity = 255;
- }));
+ });
}
appIcon.connect('menu-state-changed',
- Lang.bind(this, function(appIcon, opened) {
+ (appIcon, opened) => {
this._itemMenuStateChanged(item, opened);
- }));
+ });
let item = new DashItemContainer();
item.setChild(appIcon.actor);
if (this._showLabelTimeoutId == 0) {
let timeout = this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT;
this._showLabelTimeoutId = Mainloop.timeout_add(timeout,
- Lang.bind(this, function() {
+ () => {
this._labelShowing = true;
item.showLabel();
this._showLabelTimeoutId = 0;
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(this._showLabelTimeoutId, '[gnome-shell] item.showLabel');
if (this._resetHoverTimeoutId > 0) {
Mainloop.source_remove(this._resetHoverTimeoutId);
item.hideLabel();
if (this._labelShowing) {
this._resetHoverTimeoutId = Mainloop.timeout_add(DASH_ITEM_HOVER_TIMEOUT,
- Lang.bind(this, function() {
+ () => {
this._labelShowing = false;
this._resetHoverTimeoutId = 0;
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(this._resetHoverTimeoutId, '[gnome-shell] this._labelShowing');
}
}
// icons (i.e. ignoring drag placeholders) and which are not
// animating out (which means they will be destroyed at the end of
// the animation)
- let iconChildren = this._box.get_children().filter(function(actor) {
+ let iconChildren = this._box.get_children().filter(actor => {
return actor.child &&
actor.child._delegate &&
actor.child._delegate.icon &&
let availSize = availHeight / iconChildren.length;
- let iconSizes = baseIconSizes.map(function(s) {
- return s * scaleFactor;
- });
+ let iconSizes = baseIconSizes.map(s => s * scaleFactor);
let newIconSize = baseIconSizes[0];
for (let i = 0; i < iconSizes.length; i++) {
let running = this._appSystem.get_running();
- let children = this._box.get_children().filter(function(actor) {
+ let children = this._box.get_children().filter(actor => {
return actor.child &&
actor.child._delegate &&
actor.child._delegate.app;
});
// Apps currently in the dash
- let oldApps = children.map(function(actor) {
- return actor.child._delegate.app;
- });
+ let oldApps = children.map(actor => actor.child._delegate.app);
// Apps supposed to be in the dash
let newApps = [];
let nextApp = newApps.length > newIndex + 1 ? newApps[newIndex + 1]
: null;
let insertHere = nextApp && nextApp == oldApp;
- let alreadyRemoved = removedActors.reduce(function(result, actor) {
+ let alreadyRemoved = removedActors.reduce((result, actor) => {
let removedApp = actor.child._delegate.app;
return result || removedApp == newApp;
}, false);
if (this._dragPlaceholder) {
this._animatingPlaceholdersCount++;
this._dragPlaceholder.animateOutAndDestroy();
- this._dragPlaceholder.connect('destroy',
- Lang.bind(this, function() {
- this._animatingPlaceholdersCount--;
- }));
+ this._dragPlaceholder.connect('destroy', () => {
+ this._animatingPlaceholdersCount--;
+ });
this._dragPlaceholder = null;
}
this._dragPlaceholderPos = -1;
if (!this._dragPlaceholder)
return true;
- Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
- function () {
- let appFavorites = AppFavorites.getAppFavorites();
- if (srcIsFavorite)
- appFavorites.moveFavoriteToPos(id, favPos);
- else
- appFavorites.addFavoriteAtPos(id, favPos);
- return false;
- }));
+ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
+ let appFavorites = AppFavorites.getAppFavorites();
+ if (srcIsFavorite)
+ appFavorites.moveFavoriteToPos(id, favPos);
+ else
+ appFavorites.addFavoriteAtPos(id, favPos);
+ return false;
+ });
return true;
}
can_focus: true,
reactive: false
});
- this.actor.connect('clicked', Lang.bind(this,
- function() {
- this._calendar.setDate(new Date(), false);
- }));
+ this.actor.connect('clicked', () => {
+ this._calendar.setDate(new Date(), false);
+ });
let hbox = new St.BoxLayout({ vertical: true });
this.actor.add_actor(hbox);
hbox.add_actor(this._dateLabel);
this._calendar = calendar;
- this._calendar.connect('selected-date-changed', Lang.bind(this,
- function(calendar, date) {
- // Make the button reactive only if the selected date is not the
- // current date.
- this.actor.reactive = !_isToday(date)
- }));
+ this._calendar.connect('selected-date-changed', (calendar, date) => {
+ // Make the button reactive only if the selected date is not the
+ // current date.
+ this.actor.reactive = !_isToday(date)
+ });
},
setDate(date) {
this.actor = new St.Button({ style_class: 'world-clocks-button',
x_fill: true,
can_focus: true });
- this.actor.connect('clicked', Lang.bind(this,
- function() {
- this._clockAppMon.activateApp();
+ this.actor.connect('clicked', () => {
+ this._clockAppMon.activateApp();
- Main.overview.hide();
- Main.panel.closeCalendar();
- }));
+ Main.overview.hide();
+ Main.panel.closeCalendar();
+ });
let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
this._grid = new St.Widget({ style_class: 'world-clocks-grid',
this._locations.push({ location: l });
}
- this._locations.sort(function(a, b) {
+ this._locations.sort((a, b) => {
return a.location.get_timezone().get_offset() -
b.location.get_timezone().get_offset();
});
Main.messageTray.connect('queue-changed', Lang.bind(this, this._updateCount));
let sources = Main.messageTray.getSources();
- sources.forEach(Lang.bind(this, function(source) { this._onSourceAdded(null, source); }));
+ sources.forEach(source => { this._onSourceAdded(null, source); });
},
_onSourceAdded(tray, source) {
_updateCount() {
let count = 0;
- this._sources.forEach(Lang.bind(this,
- function(source) {
- count += source.unseenCount;
- }));
+ this._sources.forEach(source => { count += source.unseenCount; });
count -= Main.messageTray.queueCount;
this.actor.visible = (count > 0);
this._calendar = new Calendar.Calendar();
this._calendar.connect('selected-date-changed',
- Lang.bind(this, function(calendar, date) {
+ (calendar, date) => {
layout.frozen = !_isToday(date);
this._messageList.setDate(date);
- }));
+ });
- this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) {
+ this.menu.connect('open-state-changed', (menu, isOpen) => {
// Whenever the menu is opened, select today
if (isOpen) {
let now = new Date();
this._date.setDate(now);
this._messageList.setDate(now);
}
- }));
+ });
// Fill up the first column
this._messageList = new Calendar.CalendarMessageList();
Main.uiGroup.add_actor(eventHandlerActor);
// We connect to 'event' rather than 'captured-event' because the capturing phase doesn't happen
// when you've grabbed the pointer.
- eventHandlerActor.connect('event',
- function(actor, event) {
- return currentDraggable._onEvent(actor, event);
- });
+ eventHandlerActor.connect('event', (actor, event) => {
+ return currentDraggable._onEvent(actor, event);
+ });
}
return eventHandlerActor;
}
Lang.bind(this, this._onTouchEvent));
}
- this.actor.connect('destroy', Lang.bind(this, function() {
+ this.actor.connect('destroy', () => {
this._actorDestroyed = true;
if (this._dragInProgress && this._dragCancellable)
this._cancelDrag(global.get_current_time());
this.disconnectAll();
- }));
+ });
this._onEventId = null;
this._touchSequence = null;
this._allowedModes = allowedModes;
this.set_n_touch_points(1);
- global.display.connect('grab-op-begin', Lang.bind(this, function() {
- this.cancel();
- }));
+ global.display.connect('grab-op-begin', () => { this.cancel(); });
},
_getMonitorRect(x, y) {
this._pkOfflineProxy = new PkOfflineProxy(Gio.DBus.system,
'org.freedesktop.PackageKit',
'/org/freedesktop/PackageKit',
- Lang.bind(this, function(proxy, error) {
+ (proxy, error) => {
if (error)
log(error.message);
- }));
+ });
this._powerProxy = new UPowerProxy(Gio.DBus.system,
'org.freedesktop.UPower',
'/org/freedesktop/UPower',
- Lang.bind(this, function(proxy, error) {
+ (proxy, error) => {
if (error) {
log(error.message);
return;
this._powerProxy.connect('g-properties-changed',
Lang.bind(this, this._sync));
this._sync();
- }));
+ });
this._secondsLeft = 0;
this._totalSecondsToStayOpen = 0;
for (let i = 0; i < dialogContent.confirmButtons.length; i++) {
let signal = dialogContent.confirmButtons[i].signal;
let label = dialogContent.confirmButtons[i].label;
- buttons.push({ action: Lang.bind(this, function() {
- this.close(true);
- let signalId = this.connect('closed',
- Lang.bind(this, function() {
- this.disconnect(signalId);
- this._confirm(signal);
- }));
- }),
+ buttons.push({ action: () => {
+ this.close(true);
+ let signalId = this.connect('closed', () => {
+ this.disconnect(signalId);
+ this._confirm(signal);
+ });
+ },
label: label });
}
},
_confirm(signal) {
- let callback = Lang.bind(this, function() {
+ let callback = () => {
this._fadeOutDialog();
this._stopTimer();
this._dbusImpl.emit_signal(signal, null);
- });
+ };
// Offline update not available; just emit the signal
if (!this._checkBox.actor.visible) {
},
_triggerOfflineUpdateReboot(callback) {
- this._pkOfflineProxy.TriggerRemote('reboot',
- function (result, error) {
+ this._pkOfflineProxy.TriggerRemote('reboot', (result, error) => {
if (error)
log(error.message);
},
_triggerOfflineUpdateShutdown(callback) {
- this._pkOfflineProxy.TriggerRemote('power-off',
- function (result, error) {
+ this._pkOfflineProxy.TriggerRemote('power-off', (result, error) => {
if (error)
log(error.message);
},
_triggerOfflineUpdateCancel(callback) {
- this._pkOfflineProxy.CancelRemote(function (result, error) {
+ this._pkOfflineProxy.CancelRemote((result, error) => {
if (error)
log(error.message);
let startTime = GLib.get_monotonic_time();
this._secondsLeft = this._totalSecondsToStayOpen;
- this._timerId = Mainloop.timeout_add_seconds(1, Lang.bind(this,
- function() {
- let currentTime = GLib.get_monotonic_time();
- let secondsElapsed = ((currentTime - startTime) / 1000000);
+ this._timerId = Mainloop.timeout_add_seconds(1, () => {
+ let currentTime = GLib.get_monotonic_time();
+ let secondsElapsed = ((currentTime - startTime) / 1000000);
- this._secondsLeft = this._totalSecondsToStayOpen - secondsElapsed;
- if (this._secondsLeft > 0) {
- this._sync();
- return GLib.SOURCE_CONTINUE;
- }
+ this._secondsLeft = this._totalSecondsToStayOpen - secondsElapsed;
+ if (this._secondsLeft > 0) {
+ this._sync();
+ return GLib.SOURCE_CONTINUE;
+ }
- let dialogContent = DialogContent[this._type];
- let button = dialogContent.confirmButtons[dialogContent.confirmButtons.length - 1];
- this._confirm(button.signal);
- this._timerId = 0;
+ let dialogContent = DialogContent[this._type];
+ let button = dialogContent.confirmButtons[dialogContent.confirmButtons.length - 1];
+ this._confirm(button.signal);
+ this._timerId = 0;
- return GLib.SOURCE_REMOVE;
- }));
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(this._timerId, '[gnome-shell] this._confirm');
},
},
_loadSessions() {
- this._loginManager.listSessions(Lang.bind(this, function(result) {
+ this._loginManager.listSessions(result => {
let n = 0;
for (let i = 0; i < result.length; i++) {
let[id, uid, userName, seat, sessionPath] = result[i];
}
this._sync();
- }));
+ });
},
OpenAsync(parameters, invocation) {
let dialogContent = DialogContent[this._type];
for (let i = 0; i < inhibitorObjectPaths.length; i++) {
- let inhibitor = new GnomeSession.Inhibitor(inhibitorObjectPaths[i], Lang.bind(this, function(proxy, error) {
+ let inhibitor = new GnomeSession.Inhibitor(inhibitorObjectPaths[i], (proxy, error) => {
this._onInhibitorLoaded(proxy);
- }));
+ });
this._applications.push(inhibitor);
}
this._sync();
- let signalId = this.connect('opened',
- Lang.bind(this, function() {
- invocation.return_value(null);
- this.disconnect(signalId);
- }));
+ let signalId = this.connect('opened', () => {
+ invocation.return_value(null);
+ this.disconnect(signalId);
+ });
},
Close(parameters, invocation) {
function _patchLayoutClass(layoutClass, styleProps) {
if (styleProps)
layoutClass.prototype.hookup_style = function(container) {
- container.connect('style-changed', Lang.bind(this, function() {
+ container.connect('style-changed', () => {
let node = container.get_theme_node();
for (let prop in styleProps) {
let [found, length] = node.lookup_length(styleProps[prop], false);
if (found)
this[prop] = length;
}
- }));
+ });
};
layoutClass.prototype.child_set = function(actor, props) {
let meta = this.get_child_meta(actor.get_parent(), actor);
window._ = Gettext.gettext;
window.C_ = Gettext.pgettext;
window.ngettext = Gettext.ngettext;
- window.N_ = function(s) { return s; };
+ window.N_ = s => s;
// Miscellaneous monkeypatching
_patchContainerClass(St.BoxLayout);
let message = Soup.form_request_new_from_hash('GET', REPOSITORY_URL_INFO, params);
- _httpSession.queue_message(message, function(session, message) {
+ _httpSession.queue_message(message, (session, message) => {
if (message.status_code != Soup.KnownStatusCode.OK) {
ExtensionSystem.logExtensionError(uuid, 'downloading info: ' + message.status_code);
invocation.return_dbus_error('org.gnome.Shell.DownloadInfoError', message.status_code.toString());
return;
}
- GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, function(pid, status) {
+ GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, (pid, status) => {
GLib.spawn_close_pid(pid);
if (status != 0)
let url = REPOSITORY_URL_DOWNLOAD.format(uuid);
let message = Soup.form_request_new_from_hash('GET', url, params);
- _httpSession.queue_message(message, Lang.bind(this, function(session, message) {
- gotExtensionZipFile(session, message, uuid, newExtensionTmpDir, function() {
+ _httpSession.queue_message(message, (session, message) => {
+ gotExtensionZipFile(session, message, uuid, newExtensionTmpDir, () => {
let oldExtension = ExtensionUtils.extensions[uuid];
let extensionDir = oldExtension.dir;
}
FileUtils.recursivelyDeleteDir(oldExtensionTmpDir, true);
- }, function(code, message) {
+ }, (code, message) => {
log('Error while updating extension %s: %s (%s)'.format(uuid, code, message ? message : ''));
});
- }));
+ });
}
function checkForUpdates() {
let url = REPOSITORY_URL_UPDATE;
let message = Soup.form_request_new_from_hash('GET', url, params);
- _httpSession.queue_message(message, function(session, message) {
+ _httpSession.queue_message(message, (session, message) => {
if (message.status_code != Soup.KnownStatusCode.OK)
return;
invocation.return_value(GLib.Variant.new('(s)', ['successful']));
}
- _httpSession.queue_message(message, Lang.bind(this, function(session, message) {
+ _httpSession.queue_message(message, (session, message) => {
gotExtensionZipFile(session, message, uuid, dir, callback, errback);
- }));
+ });
this.close();
}
// Find and enable all the newly enabled extensions: UUIDs found in the
// new setting, but not in the old one.
- newEnabledExtensions.filter(function(uuid) {
- return enabledExtensions.indexOf(uuid) == -1;
- }).forEach(function(uuid) {
+ newEnabledExtensions.filter(
+ uuid => !enabledExtensions.includes(uuid)
+ ).forEach(uuid => {
enableExtension(uuid);
});
// Find and disable all the newly disabled extensions: UUIDs found in the
// old setting, but not in the new one.
- enabledExtensions.filter(function(item) {
- return newEnabledExtensions.indexOf(item) == -1;
- }).forEach(function(uuid) {
+ enabledExtensions.filter(
+ item => !newEnabledExtensions.includes(item)
+ ).forEach(uuid => {
disableExtension(uuid);
});
enabledExtensions = getEnabledExtensions();
if (Main.sessionMode.allowExtensions) {
- enabledExtensions.forEach(function(uuid) {
+ enabledExtensions.forEach(uuid => {
enableExtension(uuid);
});
}
enabledExtensions = getEnabledExtensions();
let finder = new ExtensionUtils.ExtensionFinder();
- finder.connect('extension-found', function(finder, extension) {
+ finder.connect('extension-found', (finder, extension) => {
loadExtension(extension);
});
finder.scanExtensions();
_loadExtensions();
initted = true;
} else {
- enabledExtensions.forEach(function(uuid) {
+ enabledExtensions.forEach(uuid => {
enableExtension(uuid);
});
}
return;
if (initted) {
- extensionOrder.slice().reverse().forEach(function(uuid) {
+ extensionOrder.slice().reverse().forEach(uuid => {
disableExtension(uuid);
});
}
// Adds @actor to the set of actors that are allowed to process events
// during a grab.
addActor(actor) {
- actor.__grabHelperDestroyId = actor.connect('destroy', Lang.bind(this, function() { this.removeActor(actor); }));
+ actor.__grabHelperDestroyId = actor.connect('destroy', () => {
+ this.removeActor(actor);
+ });
this._actors.push(actor);
},
this.actor.add(box);
let j = i;
- box.connect('button-release-event', Lang.bind(this, function(actor, event) {
+ box.connect('button-release-event', (actor, event) => {
this.emit('candidate-clicked', j, event.get_button(), event.get_state());
return Clutter.EVENT_PROPAGATE;
- }));
+ });
}
- this.actor.connect('scroll-event', Lang.bind(this, function(actor, event) {
+ this.actor.connect('scroll-event', (actor, event) => {
let direction = event.get_scroll_direction();
switch(direction) {
case Clutter.ScrollDirection.UP:
break;
};
return Clutter.EVENT_PROPAGATE;
- }));
+ });
this._buttonBox = new St.BoxLayout({ style_class: 'candidate-page-button-box' });
this.actor.add(this._buttonBox);
- this._previousButton.connect('clicked', Lang.bind(this, function() {
+ this._previousButton.connect('clicked', () => {
this.emit('previous-page');
- }));
- this._nextButton.connect('clicked', Lang.bind(this, function() {
+ });
+ this._nextButton.connect('clicked', () => {
this.emit('next-page');
- }));
+ });
this._orientation = -1;
this._cursorPosition = 0;
this._candidateArea = new CandidateArea();
box.add(this._candidateArea.actor);
- this._candidateArea.connect('previous-page', Lang.bind(this, function() {
+ this._candidateArea.connect('previous-page', () => {
this._panelService.page_up();
- }));
- this._candidateArea.connect('next-page', Lang.bind(this, function() {
+ });
+ this._candidateArea.connect('next-page', () => {
this._panelService.page_down();
- }));
+ });
- this._candidateArea.connect('cursor-up', Lang.bind(this, function() {
+ this._candidateArea.connect('cursor-up', () => {
this._panelService.cursor_up();
- }));
- this._candidateArea.connect('cursor-down', Lang.bind(this, function() {
+ });
+ this._candidateArea.connect('cursor-down', () => {
this._panelService.cursor_down();
- }));
+ });
- this._candidateArea.connect('candidate-clicked', Lang.bind(this, function(ca, index, button, state) {
+ this._candidateArea.connect('candidate-clicked', () => {
this._panelService.candidate_clicked(index, button, state);
- }));
+ });
this._panelService = null;
},
if (!panelService)
return;
- panelService.connect('set-cursor-location',
- Lang.bind(this, function(ps, x, y, w, h) {
- this._setDummyCursorGeometry(x, y, w, h);
- }));
+ panelService.connect('set-cursor-location', (ps, x, y, w, h) => {
+ this._setDummyCursorGeometry(x, y, w, h);
+ });
try {
- panelService.connect('set-cursor-location-relative',
- Lang.bind(this, function(ps, x, y, w, h) {
- if (!global.display.focus_window)
- return;
- let window = global.display.focus_window.get_compositor_private();
- this._setDummyCursorGeometry(window.x + x, window.y + y, w, h);
- }));
+ panelService.connect('set-cursor-location-relative', (ps, x, y, w, h) => {
+ if (!global.display.focus_window)
+ return;
+ let window = global.display.focus_window.get_compositor_private();
+ this._setDummyCursorGeometry(window.x + x, window.y + y, w, h);
+ });
} catch(e) {
// Only recent IBus versions have support for this signal
// which is used for wayland clients. In order to work
// with older IBus versions we can silently ignore the
// signal's absence.
}
- panelService.connect('update-preedit-text',
- Lang.bind(this, function(ps, text, cursorPosition, visible) {
- this._preeditText.visible = visible;
- this._updateVisibility();
-
- this._preeditText.text = text.get_text();
-
- let attrs = text.get_attributes();
- if (attrs)
- this._setTextAttributes(this._preeditText.clutter_text,
- attrs);
- }));
- panelService.connect('show-preedit-text',
- Lang.bind(this, function(ps) {
- this._preeditText.show();
- this._updateVisibility();
- }));
- panelService.connect('hide-preedit-text',
- Lang.bind(this, function(ps) {
- this._preeditText.hide();
- this._updateVisibility();
- }));
- panelService.connect('update-auxiliary-text',
- Lang.bind(this, function(ps, text, visible) {
- this._auxText.visible = visible;
- this._updateVisibility();
-
- this._auxText.text = text.get_text();
- }));
- panelService.connect('show-auxiliary-text',
- Lang.bind(this, function(ps) {
- this._auxText.show();
- this._updateVisibility();
- }));
- panelService.connect('hide-auxiliary-text',
- Lang.bind(this, function(ps) {
- this._auxText.hide();
- this._updateVisibility();
- }));
- panelService.connect('update-lookup-table',
- Lang.bind(this, function(ps, lookupTable, visible) {
- this._candidateArea.actor.visible = visible;
- this._updateVisibility();
-
- let nCandidates = lookupTable.get_number_of_candidates();
- let cursorPos = lookupTable.get_cursor_pos();
- let pageSize = lookupTable.get_page_size();
- let nPages = Math.ceil(nCandidates / pageSize);
- let page = ((cursorPos == 0) ? 0 : Math.floor(cursorPos / pageSize));
- let startIndex = page * pageSize;
- let endIndex = Math.min((page + 1) * pageSize, nCandidates);
-
- let indexes = [];
- let indexLabel;
- for (let i = 0; indexLabel = lookupTable.get_label(i); ++i)
- indexes.push(indexLabel.get_text());
-
- Main.keyboard.resetSuggestions();
-
- let candidates = [];
- for (let i = startIndex; i < endIndex; ++i) {
- candidates.push(lookupTable.get_candidate(i).get_text());
-
- Main.keyboard.addSuggestion(lookupTable.get_candidate(i).get_text(), Lang.bind(this, function() {
- let index = i;
- this._panelService.candidate_clicked(index, 1, 0);
- }));
- }
-
- this._candidateArea.setCandidates(indexes,
- candidates,
- cursorPos % pageSize,
- lookupTable.is_cursor_visible());
- this._candidateArea.setOrientation(lookupTable.get_orientation());
- this._candidateArea.updateButtons(lookupTable.is_round(), page, nPages);
- }));
- panelService.connect('show-lookup-table',
- Lang.bind(this, function(ps) {
- this._candidateArea.actor.show();
- this._updateVisibility();
- }));
- panelService.connect('hide-lookup-table',
- Lang.bind(this, function(ps) {
- this._candidateArea.actor.hide();
- this._updateVisibility();
- }));
- panelService.connect('focus-out',
- Lang.bind(this, function(ps) {
- this._boxPointer.hide(BoxPointer.PopupAnimation.NONE);
- Main.keyboard.resetSuggestions();
- }));
+ panelService.connect('update-preedit-text', (ps, text, cursorPosition, visible) => {
+ this._preeditText.visible = visible;
+ this._updateVisibility();
+
+ this._preeditText.text = text.get_text();
+
+ let attrs = text.get_attributes();
+ if (attrs)
+ this._setTextAttributes(this._preeditText.clutter_text,
+ attrs);
+ });
+ panelService.connect('show-preedit-text', ps => {
+ this._preeditText.show();
+ this._updateVisibility();
+ });
+ panelService.connect('hide-preedit-text', ps => {
+ this._preeditText.hide();
+ this._updateVisibility();
+ });
+ panelService.connect('update-auxiliary-text', (ps, text, visible) => {
+ this._auxText.visible = visible;
+ this._updateVisibility();
+
+ this._auxText.text = text.get_text();
+ });
+ panelService.connect('show-auxiliary-text', ps => {
+ this._auxText.show();
+ this._updateVisibility();
+ });
+ panelService.connect('hide-auxiliary-text', ps => {
+ this._auxText.hide();
+ this._updateVisibility();
+ });
+ panelService.connect('update-lookup-table', (ps, lookupTable, visible) => {
+ this._candidateArea.actor.visible = visible;
+ this._updateVisibility();
+
+ let nCandidates = lookupTable.get_number_of_candidates();
+ let cursorPos = lookupTable.get_cursor_pos();
+ let pageSize = lookupTable.get_page_size();
+ let nPages = Math.ceil(nCandidates / pageSize);
+ let page = ((cursorPos == 0) ? 0 : Math.floor(cursorPos / pageSize));
+ let startIndex = page * pageSize;
+ let endIndex = Math.min((page + 1) * pageSize, nCandidates);
+
+ let indexes = [];
+ let indexLabel;
+ for (let i = 0; indexLabel = lookupTable.get_label(i); ++i)
+ indexes.push(indexLabel.get_text());
+
+ Main.keyboard.resetSuggestions();
+
+ let candidates = [];
+ for (let i = startIndex; i < endIndex; ++i) {
+ candidates.push(lookupTable.get_candidate(i).get_text());
+
+ Main.keyboard.addSuggestion(lookupTable.get_candidate(i).get_text(), () => {
+ let index = i;
+ this._panelService.candidate_clicked(index, 1, 0);
+ });
+ }
+
+ this._candidateArea.setCandidates(indexes,
+ candidates,
+ cursorPos % pageSize,
+ lookupTable.is_cursor_visible());
+ this._candidateArea.setOrientation(lookupTable.get_orientation());
+ this._candidateArea.updateButtons(lookupTable.is_round(), page, nPages);
+ });
+ panelService.connect('show-lookup-table', ps => {
+ this._candidateArea.actor.show();
+ this._updateVisibility();
+ });
+ panelService.connect('hide-lookup-table', ps => {
+ this._candidateArea.actor.hide();
+ this._updateVisibility();
+ });
+ panelService.connect('focus-out', ps => {
+ this._boxPointer.hide(BoxPointer.PopupAnimation.NONE);
+ Main.keyboard.resetSuggestions();
+ });
},
_setDummyCursorGeometry(x, y, w, h) {
},
_getVisibleChildren() {
- let children = this._grid.get_children();
- children = children.filter(function(actor) {
- return actor.visible;
- });
- return children;
+ return this._grid.get_children().filter(actor => actor.visible);
},
_getPreferredHeight(grid, forWidth, alloc) {
delay: delay,
scale_x: ANIMATION_BOUNCE_ICON_SCALE,
scale_y: ANIMATION_BOUNCE_ICON_SCALE,
- onComplete: Lang.bind(this, function() {
+ onComplete: () => {
Tweener.addTween(actor,
{ time: ANIMATION_TIME_IN - bounceUpTime,
transition: 'easeInOutQuad',
scale_x: 1,
scale_y: 1,
- onComplete: Lang.bind(this, function() {
+ onComplete: () => {
if (isLastItem)
this._animationDone();
actor.reactive = true;
- })
+ }
});
- })
+ }
});
}
},
// Design decision, 1/2 of the source actor size.
let [sourceScaledWidth, sourceScaledHeight] = [sourceWidth / 2, sourceHeight / 2];
- actors.forEach(function(actor) {
+ actors.forEach(actor => {
let [actorX, actorY] = actor._transformedPosition = actor.get_transformed_position();
let [x, y] = [actorX - sourceX, actorY - sourceY];
actor._distance = Math.sqrt(x * x + y * y);
});
- let maxDist = actors.reduce(function(prev, cur) {
+ let maxDist = actors.reduce((prev, cur) => {
return Math.max(prev, cur._distance);
}, 0);
- let minDist = actors.reduce(function(prev, cur) {
+ let minDist = actors.reduce((prev, cur) => {
return Math.min(prev, cur._distance);
}, Infinity);
let normalization = maxDist - minDist;
y: finalY,
scale_x: 1,
scale_y: 1,
- onComplete: Lang.bind(this, function() {
+ onComplete: () => {
if (isLastItem)
this._animationDone();
actor.opacity = 255;
actor.reactive = true;
actorClone.destroy();
- })};
+ }};
fadeParams = { time: ANIMATION_FADE_IN_TIME_FOR_ITEM,
transition: 'easeInOutQuad',
delay: delay,
y: adjustedSourcePositionY,
scale_x: scaleX,
scale_y: scaleY,
- onComplete: Lang.bind(this, function() {
+ onComplete: () => {
if (isLastItem) {
this._animationDone();
this._restoreItemsOpacity();
}
actor.reactive = true;
actorClone.destroy();
- })};
+ }};
fadeParams = { time: ANIMATION_FADE_IN_TIME_FOR_ITEM,
transition: 'easeInOutQuad',
delay: ANIMATION_TIME_OUT + delay - ANIMATION_FADE_IN_TIME_FOR_ITEM,
transition: 'easeInOutQuad'
};
if (i == (children.length - 1))
- params.onComplete = Lang.bind(this,
- function() {
- this.emit('space-opened');
- });
+ params.onComplete = () => { this.emit('space-opened'); };
Tweener.addTween(children[i], params);
}
},
{ translation_y: 0,
time: EXTRA_SPACE_ANIMATION_TIME,
transition: 'easeInOutQuad',
- onComplete: Lang.bind(this,
- function() {
- this.emit('space-closed');
- })
+ onComplete: () => { this.emit('space-closed'); }
});
}
}
for (let i in inputSources) {
let is = inputSources[i];
- this.addAction(is.displayName, Lang.bind(this, () => {
+ this.addAction(is.displayName, () => {
inputSourceManager.activateInputSource(is, true);
- }));
+ });
}
this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
this.addAction(_("Region & Language Settings"), Lang.bind(this, this._launchSettings));
this._capturedEventId = 0;
- this._unmapId = actor.connect('notify::mapped', Lang.bind(this, function() {
+ this._unmapId = actor.connect('notify::mapped', () => {
if (!actor.is_mapped())
this.close(true);
- }));
+ });
},
_launchSettings() {
if (key == this.key) {
this._pressTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
KEY_LONG_PRESS_TIME,
- Lang.bind(this, function() {
+ () => {
this._longPress = true;
this._pressTimeoutId = 0;
}
return GLib.SOURCE_REMOVE;
- }));
+ });
}
},
this._boxPointer.show(BoxPointer.PopupAnimation.FULL);
this._capturedEventId = global.stage.connect('captured-event',
Lang.bind(this, this._onCapturedEvent));
- this._unmapId = this.keyButton.connect('notify::mapped', Lang.bind(this, function() {
+ this._unmapId = this.keyButton.connect('notify::mapped', () => {
if (!this.keyButton.is_mapped())
this._hideSubkeys();
- }));
+ });
},
_hideSubkeys() {
style_class: 'keyboard-key' });
button.keyWidth = 1;
- button.connect('button-press-event', Lang.bind(this,
- function () {
- this._press(key);
+ button.connect('button-press-event', () => {
+ this._press(key);
+ return Clutter.EVENT_PROPAGATE;
+ });
+ button.connect('button-release-event', () => {
+ this._release(key);
+ return Clutter.EVENT_PROPAGATE;
+ });
+ button.connect('touch-event', (actor, event) => {
+ let device = event.get_device();
+ let sequence = event.get_event_sequence();
+
+ // We only handle touch events here on wayland. On X11
+ // we do get emulated pointer events, which already works
+ // for single-touch cases. Besides, the X11 passive touch grab
+ // set up by Mutter will make us see first the touch events
+ // and later the pointer events, so it will look like two
+ // unrelated series of events, we want to avoid double handling
+ // in these cases.
+ if (!Meta.is_wayland_compositor())
return Clutter.EVENT_PROPAGATE;
- }));
- button.connect('button-release-event', Lang.bind(this,
- function () {
+
+ if (!this._touchPressed &&
+ event.type() == Clutter.EventType.TOUCH_BEGIN) {
+ device.sequence_grab(sequence, actor);
+ this._touchPressed = true;
+ this._press(key);
+ } else if (this._touchPressed &&
+ event.type() == Clutter.EventType.TOUCH_END &&
+ device.sequence_get_grabbed_actor(sequence) == actor) {
+ device.sequence_ungrab(sequence);
+ this._touchPressed = false;
this._release(key);
- return Clutter.EVENT_PROPAGATE;
- }));
- button.connect('touch-event', Lang.bind(this,
- function (actor, event) {
- let device = event.get_device();
- let sequence = event.get_event_sequence();
-
- // We only handle touch events here on wayland. On X11
- // we do get emulated pointer events, which already works
- // for single-touch cases. Besides, the X11 passive touch grab
- // set up by Mutter will make us see first the touch events
- // and later the pointer events, so it will look like two
- // unrelated series of events, we want to avoid double handling
- // in these cases.
- if (!Meta.is_wayland_compositor())
- return Clutter.EVENT_PROPAGATE;
-
- if (!this._touchPressed &&
- event.type() == Clutter.EventType.TOUCH_BEGIN) {
- device.sequence_grab(sequence, actor);
- this._touchPressed = true;
- this._press(key);
- } else if (this._touchPressed &&
- event.type() == Clutter.EventType.TOUCH_END &&
- device.sequence_get_grabbed_actor(sequence) == actor) {
- device.sequence_ungrab(sequence);
- this._touchPressed = false;
- this._release(key);
- }
- return Clutter.EVENT_PROPAGATE;
- }));
+ }
+ return Clutter.EVENT_PROPAGATE;
+ });
return button;
},
this._lastDeviceId = null;
this._suggestions = null;
- Meta.get_backend().connect('last-device-changed', Lang.bind(this,
- function (backend, deviceId) {
+ Meta.get_backend().connect('last-device-changed',
+ (backend, deviceId) => {
let manager = Clutter.DeviceManager.get_default();
let device = manager.get_device(deviceId);
this._lastDeviceId = deviceId;
this._syncEnabled();
}
- }));
+ });
this._syncEnabled();
this._showIdleId = 0;
this._keyboardVisible = false;
- Main.layoutManager.connect('keyboard-visible-changed', Lang.bind(this, function(o, visible) {
+ Main.layoutManager.connect('keyboard-visible-changed', (o, visible) => {
this._keyboardVisible = visible;
- }));
+ });
this._keyboardRequested = false;
this._keyboardRestingId = 0;
Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._relayout));
- //Main.inputMethod.connect('cursor-location-changed', Lang.bind(this, function(o, rect) {
+ //Main.inputMethod.connect('cursor-location-changed', (o, rect) => {
// if (this._keyboardVisible) {
// let currentWindow = global.screen.get_display().focus_window;
// this.setCursorLocation(currentWindow, rect.get_x(), rect.get_y(),
// rect.get_width(), rect.get_height());
// }
- //}));
+ //});
},
get visible() {
GLib.source_remove(this._updateCaretPositionId);
if (!this._keyboardRequested)
return;
- this._updateCaretPositionId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, Lang.bind(this, function() {
+ this._updateCaretPositionId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
this._updateCaretPositionId = 0;
let currentWindow = global.screen.get_display().focus_window;
}
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(this._updateCaretPositionId, '[gnome-shell] this._updateCaretPosition');
},
this._current_page = null;
this._suggestions = new Suggestions();
- this._suggestions.connect('suggestion-clicked', Lang.bind(this, function(suggestions, str) {
+ this._suggestions.connect('suggestion-clicked', (suggestions, str) => {
this._keyboardController.commitString(str);
- }));
+ });
this.actor.add(this._suggestions.actor,
{ x_align: St.Align.MIDDLE,
x_fill: false });
}
if (!this._showIdleId) {
- this._showIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE,
- Lang.bind(this, function() {
- this.show(Main.layoutManager.focusIndex);
- return GLib.SOURCE_REMOVE;
- }));
+ this._showIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
+ this.show(Main.layoutManager.focusIndex);
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(this._showIdleId, '[gnome-shell] this.show');
}
},
if (button.key == ' ')
button.setWidth(keys.length <= 3 ? 5 : 3);
- button.connect('pressed', Lang.bind(this, function(actor, keyval, str) {
+ button.connect('pressed', (actor, keyval, str) => {
if (!Main.inputMethod.currentFocus ||
!this._keyboardController.commitString(str, true)) {
if (keyval != 0) {
button._keyvalPress = true;
}
}
- }));
- button.connect('released', Lang.bind(this, function(actor, keyval, str) {
+ });
+ button.connect('released', (actor, keyval, str) => {
if (keyval != 0) {
if (button._keyvalPress)
this._keyboardController.keyvalRelease(keyval);
if (!this._latched)
this._setActiveLayer(0);
- }));
+ });
layout.appendKey(button.actor, button.keyButton.keyWidth);
}
let actor = extraButton.keyButton;
- extraButton.connect('pressed', Lang.bind(this, function() {
+ extraButton.connect('pressed', () => {
if (switchToLevel != null) {
this._setActiveLayer(switchToLevel);
// Shift only gets latched on long press
} else if (keyval != null) {
this._keyboardController.keyvalPress(keyval);
}
- }));
- extraButton.connect('released', Lang.bind(this, function() {
+ });
+ extraButton.connect('released', () => {
if (keyval != null)
this._keyboardController.keyvalRelease(keyval);
else if (action == 'hide')
this.hide();
else if (action == 'languageMenu')
this._popupLanguageMenu(actor);
- }));
+ });
if (switchToLevel == 0) {
layout.shiftKeys.push(extraButton);
} else if (switchToLevel == 1) {
- extraButton.connect('long-press', Lang.bind(this, function() {
+ extraButton.connect('long-press', () => {
this._latched = true;
this._setCurrentLevelLatched(this._current_page, this._latched);
- }));
+ });
}
/* Fixup default keys based on the number of levels/keys */
this._clearKeyboardRestTimer();
this._keyboardRestingId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
KEYBOARD_REST_TIME,
- Lang.bind(this, function() {
+ () => {
this._clearKeyboardRestTimer();
this._show(monitor);
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer');
},
this._clearKeyboardRestTimer();
this._keyboardRestingId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
KEYBOARD_REST_TIME,
- Lang.bind(this, function() {
+ () => {
this._clearKeyboardRestTimer();
this._hide();
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer');
},
Main.inputMethod.connect('notify::content-purpose', Lang.bind(this, this._onContentPurposeHintsChanged));
Main.inputMethod.connect('notify::content-hints', Lang.bind(this, this._onContentPurposeHintsChanged));
- Main.inputMethod.connect('input-panel-state', Lang.bind(this, function(o, state) { this.emit('panel-state', state); }));
+ Main.inputMethod.connect('input-panel-state', (o, state) => {
+ this.emit('panel-state', state);
+ });
},
_onSourcesModified() {
vfunc_set_actor(actor) {
if (actor) {
if (!this._monitorsChangedId) {
- this._monitorsChangedId = Main.layoutManager.connect('monitors-changed', Lang.bind(this, function() {
- this.actor.queue_relayout();
- }));
+ this._monitorsChangedId =
+ Main.layoutManager.connect('monitors-changed', () => {
+ this.actor.queue_relayout();
+ });
}
if (!this._workareasChangedId) {
- this._workareasChangedId = global.screen.connect('workareas-changed', Lang.bind(this, function() {
- if (this._workArea)
- this.actor.queue_relayout();
- }));
+ this._workareasChangedId =
+ global.screen.connect('workareas-changed', () => {
+ if (this._workArea)
+ this.actor.queue_relayout();
+ });
}
} else {
if (this._monitorsChangedId)
// Set up stage hierarchy to group all UI actors under one container.
this.uiGroup = new Shell.GenericContainer({ name: 'uiGroup' });
- this.uiGroup.connect('allocate',
- function (actor, box, flags) {
- let children = actor.get_children();
- for (let i = 0; i < children.length; i++)
- children[i].allocate_preferred_size(flags);
- });
- this.uiGroup.connect('get-preferred-width',
- function(actor, forHeight, alloc) {
- let width = global.stage.width;
- [alloc.min_size, alloc.natural_size] = [width, width];
- });
- this.uiGroup.connect('get-preferred-height',
- function(actor, forWidth, alloc) {
- let height = global.stage.height;
- [alloc.min_size, alloc.natural_size] = [height, height];
- });
+ this.uiGroup.connect('allocate', (actor, box, flags) => {
+ let children = actor.get_children();
+ for (let i = 0; i < children.length; i++)
+ children[i].allocate_preferred_size(flags);
+ });
+ this.uiGroup.connect('get-preferred-width', (actor, forHeight, alloc) => {
+ let width = global.stage.width;
+ [alloc.min_size, alloc.natural_size] = [width, width];
+ });
+ this.uiGroup.connect('get-preferred-height', (actor, forWidth, alloc) => {
+ let height = global.stage.height;
+ [alloc.min_size, alloc.natural_size] = [height, height];
+ });
global.stage.remove_actor(global.window_group);
this.uiGroup.add_actor(global.window_group);
// https://bugzilla.gnome.org/show_bug.cgi?id=739178
if (Shell.util_need_background_refresh()) {
LoginManager.getLoginManager().connect('prepare-for-sleep',
- function(lm, suspending) {
- if (suspending)
- return;
- Meta.Background.refresh_all();
- });
+ (lm, suspending) => {
+ if (suspending)
+ return;
+ Meta.Background.refresh_all();
+ });
}
},
_updateHotCorners() {
// destroy old hot corners
- this.hotCorners.forEach(function(corner) {
+ this.hotCorners.forEach(corner => {
if (corner)
corner.destroy();
});
this._updatePanelBarrier();
let size = this.panelBox.height;
- this.hotCorners.forEach(function(corner) {
+ this.hotCorners.forEach(corner => {
if (corner)
corner.setBarrierSize(size);
});
coordinate: Clutter.BindCoordinate.ALL });
this._systemBackground.actor.add_constraint(constraint);
- let signalId = this._systemBackground.connect('loaded', Lang.bind(this, function() {
+ let signalId = this._systemBackground.connect('loaded', () => {
this._systemBackground.disconnect(signalId);
this._systemBackground.actor.show();
global.stage.show();
this._prepareStartupAnimation();
- }));
+ });
},
// Startup Animations
// until the event loop is uncontended and idle.
// This helps to prevent us from running the animation
// when the system is bogged down
- let id = GLib.idle_add(GLib.PRIORITY_LOW, Lang.bind(this, function() {
+ let id = GLib.idle_add(GLib.PRIORITY_LOW, () => {
this._startupAnimation();
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(id, '[gnome-shell] this._startupAnimation');
},
// anchor point changes
this._updateRegions();
- this._keyboardHeightNotifyId = this.keyboardBox.connect('notify::height', Lang.bind(this, function () {
+ this._keyboardHeightNotifyId = this.keyboardBox.connect('notify::height', () => {
this.keyboardBox.anchor_y = this.keyboardBox.height;
- }));
+ });
},
hideKeyboard(immediate) {
},
_getWindowActorsForWorkspace(workspace) {
- return global.get_window_actors().filter(function (actor) {
+ return global.get_window_actors().filter(actor => {
let win = actor.meta_window;
return win.located_on_workspace(workspace);
});
_onBarrierLeft(barrier, event) {
barrier._isHit = false;
- if (this._barriers.every(function(b) { return !b._isHit; })) {
+ if (this._barriers.every(b => !b._isHit)) {
this._reset();
this._isTriggered = false;
}
vignetteSharpness: VIGNETTE_SHARPNESS,
time: fadeInTime,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this, function() {
+ onComplete: () => {
this.shown = true;
this.emit('shown');
- })
+ }
});
} else {
Tweener.addTween(this.actor,
{ opacity: 255 * this._fadeFactor,
time: fadeInTime,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this, function() {
+ onComplete: () => {
this.shown = true;
this.emit('shown');
- })
+ }
});
}
opacity: 0,
time: fadeOutTime,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this, function() {
+ onComplete: () => {
this.actor.hide();
- })
+ }
});
} else {
Tweener.addTween(this.actor,
{ opacity: 0,
time: fadeOutTime,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this, function() {
+ onComplete: () => {
this.actor.hide();
- })
+ }
});
}
},
function _getAutoCompleteGlobalKeywords() {
const keywords = ['true', 'false', 'null', 'new'];
// Don't add the private properties of window (i.e., ones starting with '_')
- const windowProperties = Object.getOwnPropertyNames(window).filter(function(a){ return a.charAt(0) != '_' });
+ const windowProperties = Object.getOwnPropertyNames(window).filter(
+ a => a.charAt(0) != '_'
+ );
const headerProperties = JsParse.getDeclaredConstants(commandHeader);
return keywords.concat(windowProperties).concat(headerProperties);
reactive: true,
track_hover: true });
let label = new St.Button({ label: name });
- label.connect('clicked', Lang.bind(this, function () {
+ label.connect('clicked', () => {
this.selectChild(child);
return true;
- }));
+ });
labelBox.add(label, { expand: true });
this.tabControls.add(labelBox);
this.actor.add(scrollview, { expand: true });
let vAdjust = scrollview.vscroll.adjustment;
- vAdjust.connect('changed', Lang.bind(this, function () { this._onAdjustScopeChanged(tabData); }));
- vAdjust.connect('notify::value', Lang.bind(this, function() { this._onAdjustValueChanged(tabData); }));
+ vAdjust.connect('changed', () => { this._onAdjustScopeChanged(tabData); });
+ vAdjust.connect('notify::value', () => { this._onAdjustValueChanged(tabData); });
if (this._selectedIndex == -1)
this.selectIndex(0);
icon_size: 24 });
toolbar.add_actor(inspectIcon);
inspectIcon.reactive = true;
- inspectIcon.connect('button-press-event', Lang.bind(this, function () {
+ inspectIcon.connect('button-press-event', () => {
let inspector = new Inspector(this);
- inspector.connect('target', Lang.bind(this, function(i, target, stageX, stageY) {
+ inspector.connect('target', (i, target, stageX, stageY) => {
this._pushResult('inspect(' + Math.round(stageX) + ', ' + Math.round(stageY) + ')', target);
- }));
- inspector.connect('closed', Lang.bind(this, function() {
+ });
+ inspector.connect('closed', () => {
this.actor.show();
global.stage.set_key_focus(this._entry);
- }));
+ });
this.actor.hide();
return Clutter.EVENT_STOP;
- }));
+ });
let gcIcon = new St.Icon({ icon_name: 'user-trash-full',
icon_size: 24 });
toolbar.add_actor(gcIcon);
gcIcon.reactive = true;
- gcIcon.connect('button-press-event', Lang.bind(this, function () {
+ gcIcon.connect('button-press-event', () => {
gcIcon.icon_name = 'user-trash';
System.gc();
- this._timeoutId = Mainloop.timeout_add(500, Lang.bind(this, function () {
+ this._timeoutId = Mainloop.timeout_add(500, () => {
gcIcon.icon_name = 'user-trash-full';
this._timeoutId = 0;
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] gcIcon.icon_name = \'user-trash-full\'');
return Clutter.EVENT_PROPAGATE;
- }));
+ });
let notebook = new Notebook();
this._notebook = notebook;
this._extensions = new Extensions(this);
notebook.appendPage('Extensions', this._extensions.actor);
- this._entry.clutter_text.connect('activate', Lang.bind(this, function (o, e) {
+ this._entry.clutter_text.connect('activate', (o, e) => {
// Hide any completions we are currently showing
this._hideCompletions();
return true;
this._evaluate(text);
return true;
- }));
+ });
this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY,
entry: this._entry.clutter_text });
this._autoComplete = new AutoComplete(this._entry);
- this._autoComplete.connect('suggest', Lang.bind(this, function(a,e) {
+ this._autoComplete.connect('suggest', (a, e) => {
this._showCompletions(e.completions);
- }));
+ });
// If a completion is completed unambiguously, the currently-displayed completion
// suggestions become irrelevant.
- this._autoComplete.connect('completion', Lang.bind(this, function(a,e) {
+ this._autoComplete.connect('completion', (a, e) => {
if (e.type == 'whole-word')
this._hideCompletions();
- }));
+ });
this._resize();
},
transition: 'easeOutQuad',
height: 0,
opacity: 0,
- onComplete: Lang.bind(this, function () {
+ onComplete: () => {
this._completionActor.hide();
- })
+ }
});
}
},
},
_queueResize() {
- Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
- Lang.bind(this, function () { this._resize(); }));
+ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { this._resize(); });
},
_resize() {
Tweener.addTween(this.actor, { time: Math.min(0.5 / St.get_slow_down_factor(), 0.5),
transition: 'easeOutQuad',
y: this._hiddenY,
- onComplete: Lang.bind(this, function () {
+ onComplete: () => {
this.actor.hide();
- })
+ }
});
}
});
setActive(activate) {
let isActive = this.isActive();
- this._zoomRegions.forEach (function(zoomRegion, index, array) {
+ this._zoomRegions.forEach ((zoomRegion, index, array) => {
zoomRegion.setActive(activate);
});
this.yMouse = yMouse;
let sysMouseOverAny = false;
- this._zoomRegions.forEach(function(zoomRegion, index, array) {
+ this._zoomRegions.forEach((zoomRegion, index, array) => {
if (zoomRegion.scrollToMousePos())
sysMouseOverAny = true;
});
this.setCrosshairsClip(clip);
let theCrossHairs = this._crossHairs;
- this._zoomRegions.forEach (function(zoomRegion, index, array) {
+ this._zoomRegions.forEach ((zoomRegion, index, array) => {
zoomRegion.addCrosshairs(theCrossHairs);
});
},
this._appSettings = new Gio.Settings({ schema_id: APPLICATIONS_SCHEMA });
this._settings = new Gio.Settings({ schema_id: MAGNIFIER_SCHEMA });
- this._appSettings.connect('changed::' + SHOW_KEY,
- Lang.bind(this, function() {
+ this._appSettings.connect('changed::' + SHOW_KEY, () => {
this.setActive(this._appSettings.get_boolean(SHOW_KEY));
- }));
+ });
this._settings.connect('changed::' + SCREEN_POSITION_KEY,
Lang.bind(this, this._updateScreenPosition));
this._settings.connect('changed::' + CONTRAST_BLUE_KEY,
Lang.bind(this, this._updateContrast));
- this._settings.connect('changed::' + SHOW_CROSS_HAIRS_KEY,
- Lang.bind(this, function() {
+ this._settings.connect('changed::' + SHOW_CROSS_HAIRS_KEY, () => {
this.setCrosshairsVisible(this._settings.get_boolean(SHOW_CROSS_HAIRS_KEY));
- }));
+ });
- this._settings.connect('changed::' + CROSS_HAIRS_THICKNESS_KEY,
- Lang.bind(this, function() {
+ this._settings.connect('changed::' + CROSS_HAIRS_THICKNESS_KEY, () => {
this.setCrosshairsThickness(this._settings.get_int(CROSS_HAIRS_THICKNESS_KEY));
- }));
+ });
- this._settings.connect('changed::' + CROSS_HAIRS_COLOR_KEY,
- Lang.bind(this, function() {
+ this._settings.connect('changed::' + CROSS_HAIRS_COLOR_KEY, () => {
this.setCrosshairsColor(this._settings.get_string(CROSS_HAIRS_COLOR_KEY));
- }));
+ });
- this._settings.connect('changed::' + CROSS_HAIRS_OPACITY_KEY,
- Lang.bind(this, function() {
+ this._settings.connect('changed::' + CROSS_HAIRS_OPACITY_KEY, () => {
this.setCrosshairsOpacity(this._settings.get_double(CROSS_HAIRS_OPACITY_KEY));
- }));
+ });
- this._settings.connect('changed::' + CROSS_HAIRS_LENGTH_KEY,
- Lang.bind(this, function() {
+ this._settings.connect('changed::' + CROSS_HAIRS_LENGTH_KEY, () => {
this.setCrosshairsLength(this._settings.get_int(CROSS_HAIRS_LENGTH_KEY));
- }));
+ });
- this._settings.connect('changed::' + CROSS_HAIRS_CLIP_KEY,
- Lang.bind(this, function() {
+ this._settings.connect('changed::' + CROSS_HAIRS_CLIP_KEY, () => {
this.setCrosshairsClip(this._settings.get_boolean(CROSS_HAIRS_CLIP_KEY));
- }));
+ });
if (zoomRegion) {
// Mag factor is accurate to two decimal places.
}
this._clearScrollContentsTimer();
- this._scrollContentsTimerId = Mainloop.timeout_add(POINTER_REST_TIME, Lang.bind(this, function() {
+ this._scrollContentsTimerId = Mainloop.timeout_add(POINTER_REST_TIME, () => {
this._scrollContentsToDelayed(x, y);
return GLib.SOURCE_REMOVE;
- }));
+ });
},
/**
let zoomRegions = Main.magnifier.getZoomRegions();
let objectPaths = [];
let thoseZoomers = this._zoomers;
- zoomRegions.forEach (function(aZoomRegion, index, array) {
+ zoomRegions.forEach ((aZoomRegion, index, array) => {
let found = false;
for (let objectPath in thoseZoomers) {
let proxyAndZoomRegion = thoseZoomers[objectPath];
global.log = window.log;
// Chain up async errors reported from C
- global.connect('notify-error', function (global, msg, detail) { notifyError(msg, detail); });
+ global.connect('notify-error', (global, msg, detail) => {
+ notifyError(msg, detail);
+ });
Gio.DesktopAppInfo.set_desktop_env('GNOME');
_a11ySettings = new Gio.Settings({ schema_id: A11Y_SCHEMA });
- global.display.connect('overlay-key', Lang.bind(overview, function () {
+ global.display.connect('overlay-key', () => {
if (!_a11ySettings.get_boolean (STICKY_KEYS_ENABLE))
overview.toggle();
- }));
+ });
- global.display.connect('show-restart-message', function(display, message) {
+ global.display.connect('show-restart-message', (display, message) => {
showRestartMessage(message);
return true;
});
- global.display.connect('restart', function() {
+ global.display.connect('restart', () => {
global.reexec_self();
return true;
});
ExtensionSystem.init();
if (sessionMode.isGreeter && screenShield) {
- layoutManager.connect('startup-prepared', function() {
+ layoutManager.connect('startup-prepared', () => {
screenShield.showDialog();
});
}
- layoutManager.connect('startup-complete', function() {
+ layoutManager.connect('startup-complete', () => {
if (actionMode == Shell.ActionMode.NONE) {
actionMode = Shell.ActionMode.NORMAL;
}
}
modalCount += 1;
- let actorDestroyId = actor.connect('destroy', function() {
+ let actorDestroyId = actor.connect('destroy', () => {
let index = _findModal(actor);
if (index >= 0)
popModal(actor);
let prevFocus = global.stage.get_key_focus();
let prevFocusDestroyId;
if (prevFocus != null) {
- prevFocusDestroyId = prevFocus.connect('destroy', function() {
+ prevFocusDestroyId = prevFocus.connect('destroy', () => {
let index = _findModal(actor);
if (index >= 0)
modalActorFocusStack[index].prevFocus = null;
function _queueBeforeRedraw(workId) {
_beforeRedrawQueue.push(workId);
if (_beforeRedrawQueue.length == 1) {
- Meta.later_add(Meta.LaterType.BEFORE_REDRAW, function () {
+ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
_runBeforeRedrawQueue();
return false;
});
let workId = '' + (++_deferredWorkSequence);
_deferredWorkData[workId] = { 'actor': actor,
'callback': callback };
- actor.connect('notify::mapped', function () {
+ actor.connect('notify::mapped', () => {
if (!(actor.mapped && _deferredWorkQueue.indexOf(workId) >= 0))
return;
_queueBeforeRedraw(workId);
});
- actor.connect('destroy', function() {
+ actor.connect('destroy', () => {
let index = _deferredWorkQueue.indexOf(workId);
if (index >= 0)
_deferredWorkQueue.splice(index, 1);
_queueBeforeRedraw(workId);
return;
} else if (_deferredTimeoutId == 0) {
- _deferredTimeoutId = Mainloop.timeout_add_seconds(DEFERRED_TIMEOUT_SECONDS, function () {
+ _deferredTimeoutId = Mainloop.timeout_add_seconds(DEFERRED_TIMEOUT_SECONDS, () => {
_runAllDeferredWork();
_deferredTimeoutId = 0;
return GLib.SOURCE_REMOVE;
this.actor = new St.Label({ reactive: true, style_class: 'url-highlighter',
x_expand: true, x_align: Clutter.ActorAlign.START });
this._linkColor = '#ccccff';
- this.actor.connect('style-changed', Lang.bind(this, function() {
+ this.actor.connect('style-changed', () => {
let [hasColor, color] = this.actor.get_theme_node().lookup_color('link-color', false);
if (hasColor) {
let linkColor = color.to_string().substr(0, 7);
this._highlightUrls();
}
}
- }));
+ });
this.actor.clutter_text.line_wrap = lineWrap;
this.actor.clutter_text.line_wrap_mode = Pango.WrapMode.WORD_CHAR;
this.setMarkup(text, allowMarkup);
- this.actor.connect('button-press-event', Lang.bind(this, function(actor, event) {
+ this.actor.connect('button-press-event', (actor, event) => {
// Don't try to URL highlight when invisible.
// The MessageTray doesn't actually hide us, so
// we need to check for paint opacities as well.
// a pointer grab, which would block our button-release-event
// handler, if an URL is clicked
return this._findUrlAtPos(event) != -1;
- }));
- this.actor.connect('button-release-event', Lang.bind(this, function (actor, event) {
+ });
+ this.actor.connect('button-release-event', (actor, event) => {
if (!actor.visible || actor.get_paint_opacity() == 0)
return Clutter.EVENT_PROPAGATE;
return Clutter.EVENT_STOP;
}
return Clutter.EVENT_PROPAGATE;
- }));
- this.actor.connect('motion-event', Lang.bind(this, function(actor, event) {
+ });
+ this.actor.connect('motion-event', (actor, event) => {
if (!actor.visible || actor.get_paint_opacity() == 0)
return Clutter.EVENT_PROPAGATE;
this._cursorChanged = false;
}
return Clutter.EVENT_PROPAGATE;
- }));
- this.actor.connect('leave-event', Lang.bind(this, function() {
+ });
+ this.actor.connect('leave-event', () => {
if (!this.actor.visible || this.actor.get_paint_opacity() == 0)
return Clutter.EVENT_PROPAGATE;
global.screen.set_cursor(Meta.Cursor.DEFAULT);
}
return Clutter.EVENT_PROPAGATE;
- }));
+ });
},
setMarkup(text, allowMarkup) {
if (this._container)
for (let signal of ['notify::scale-x', 'notify::scale-y']) {
- let id = this._container.connect(signal, Lang.bind(this,
- function() {
- this.layout_changed();
- }));
+ let id = this._container.connect(signal, () => {
+ this.layout_changed();
+ });
this._signals.push(id);
}
},
let id = Main.sessionMode.connect('updated',
Lang.bind(this, this._sync));
- this.actor.connect('destroy', function() {
+ this.actor.connect('destroy', () => {
Main.sessionMode.disconnect(id);
});
scale_x: scale, scale_y: scale });
obj.keyFocusId = message.actor.connect('key-focus-in',
Lang.bind(this, this._onKeyFocusIn));
- obj.destroyId = message.actor.connect('destroy',
- Lang.bind(this, function() {
- this.removeMessage(message, false);
- }));
- obj.closeId = message.connect('close',
- Lang.bind(this, function() {
- this.removeMessage(message, true);
- }));
+ obj.destroyId = message.actor.connect('destroy', () => {
+ this.removeMessage(message, false);
+ });
+ obj.closeId = message.connect('close', () => {
+ this.removeMessage(message, true);
+ });
this._messages.set(message, obj);
obj.container.add_actor(message.actor);
return;
}
- let onComplete = Lang.bind(this, function() {
+ let onComplete = () => {
this._list.set_child_at_index(obj.container, index);
Tweener.addTween(obj.container, { scale_x: 1,
scale_y: 1,
time: MESSAGE_ANIMATION_TIME,
transition: 'easeOutQuad' });
- });
+ };
Tweener.addTween(obj.container, { scale_x: 0,
scale_y: 0,
time: MESSAGE_ANIMATION_TIME,
},
clear() {
- let messages = [...this._messages.keys()].filter(function(message) {
- return message.canClose();
- });
+ let messages = [...this._messages.keys()].filter(msg => msg.canClose());
// If there are few messages, letting them all zoom out looks OK
if (messages.length < 2) {
- messages.forEach(function(message) {
+ messages.forEach(message => {
message.close();
});
} else {
this._addActions();
this._addSecondaryIcon();
- this._activatedId = this.notification.connect('activated',
- Lang.bind(this, function() {
- // We hide all types of notifications once the user clicks on
- // them because the common outcome of clicking should be the
- // relevant window being brought forward and the user's
- // attention switching to the window.
- this.emit('done-displaying');
- }));
+ this._activatedId = this.notification.connect('activated', () => {
+ // We hide all types of notifications once the user clicks on
+ // them because the common outcome of clicking should be the
+ // relevant window being brought forward and the user's
+ // attention switching to the window.
+ this.emit('done-displaying');
+ });
},
_onDestroy() {
},
_addActions() {
- this.notification.actions.forEach(Lang.bind(this,
- function(action) {
- this.addAction(action.label, action.callback);
- }));
+ this.notification.actions.forEach(action => {
+ this.addAction(action.label, action.callback);
+ });
},
_addSecondaryIcon() {
return null;
this._buttonBox.add(button);
- button.connect('clicked', Lang.bind(this, function() {
+ button.connect('clicked', () => {
callback();
if (!this.notification.resident) {
this.emit('done-displaying');
this.notification.destroy();
}
- }));
+ });
return button;
},
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
this.actor.connect('allocate', Lang.bind(this, this._allocate));
- this.actor.connect('destroy', Lang.bind(this, function() {
+ this.actor.connect('destroy', () => {
this._source.disconnect(this._iconUpdatedId);
this._actorDestroyed = true;
- }));
+ });
this._actorDestroyed = false;
let scale_factor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
layout_manager: new Clutter.BinLayout() });
this._counterBin.hide();
- this._counterBin.connect('style-changed', Lang.bind(this, function() {
+ this._counterBin.connect('style-changed', () => {
let themeNode = this._counterBin.get_theme_node();
this._counterBin.translation_x = themeNode.get_length('-shell-counter-overlap-x');
this._counterBin.translation_y = themeNode.get_length('-shell-counter-overlap-y');
- }));
+ });
this.actor.add_actor(this._counterBin);
this._countUpdatedId = this._source.connect('count-updated', Lang.bind(this, this._updateCount));
this._updateCount();
- this.actor.connect('destroy', function() {
+ this.actor.connect('destroy', () => {
this._source.disconnect(this._countUpdatedId);
});
},
},
get unseenCount() {
- return this.notifications.filter(function(n) { return !n.acknowledged; }).length;
+ return this.notifications.filter(n => !n.acknowledged).length;
},
get countVisible() {
Name: 'MessageTray',
_init() {
- this._presence = new GnomeSession.Presence(Lang.bind(this, function(proxy, error) {
+ this._presence = new GnomeSession.Presence((proxy, error) => {
this._onStatusChanged(proxy.status);
- }));
+ });
this._busy = false;
this._bannerBlocked = false;
- this._presence.connectSignal('StatusChanged', Lang.bind(this, function(proxy, senderName, [status]) {
+ this._presence.connectSignal('StatusChanged', (proxy, senderName, [status]) => {
this._onStatusChanged(status);
- }));
-
- global.stage.connect('enter-event', Lang.bind(this,
- function(a, ev) {
- // HACK: St uses ClutterInputDevice for hover tracking, which
- // misses relevant X11 events when untracked actors are
- // involved (read: the notification banner in normal mode),
- // so fix up Clutter's view of the pointer position in
- // that case.
- let related = ev.get_related();
- if (!related || this.actor.contains(related))
- global.sync_pointer();
- }));
+ });
+
+ global.stage.connect('enter-event', (a, ev) => {
+ // HACK: St uses ClutterInputDevice for hover tracking, which
+ // misses relevant X11 events when untracked actors are
+ // involved (read: the notification banner in normal mode),
+ // so fix up Clutter's view of the pointer position in
+ // that case.
+ let related = ev.get_related();
+ if (!related || this.actor.contains(related))
+ global.sync_pointer();
+ });
this.actor = new St.Widget({ visible: false,
clip_to_allocation: true,
notification.connect('destroy',
Lang.bind(this, this._onNotificationDestroy));
this._notificationQueue.push(notification);
- this._notificationQueue.sort(function(notification1, notification2) {
- return (notification2.urgency - notification1.urgency);
- });
+ this._notificationQueue.sort(
+ (n1, n2) => n2.urgency - n1.urgency
+ );
this.emit('queue-changed');
}
}
// Filter out acknowledged notifications.
let changed = false;
- this._notificationQueue = this._notificationQueue.filter(function(n) {
+ this._notificationQueue = this._notificationQueue.filter(n => {
changed = changed || n.acknowledged;
return !n.acknowledged;
});
this._banner = this._notification.createBanner();
this._bannerClickedId = this._banner.connect('done-displaying',
Lang.bind(this, this._escapeTray));
- this._bannerUnfocusedId = this._banner.connect('unfocused', Lang.bind(this, function() {
+ this._bannerUnfocusedId = this._banner.connect('unfocused', () => {
this._updateState();
- }));
+ });
this._bannerBin.add_actor(this._banner.actor);
{ opacity: 255,
time: this._shouldFadeIn ? OPEN_AND_CLOSE_TIME : 0,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this,
- function() {
- this.state = State.OPENED;
- this.emit('opened');
- })
+ onComplete: () => {
+ this.state = State.OPENED;
+ this.emit('opened');
+ }
});
},
this._initialKeyFocus = actor;
- this._initialKeyFocusDestroyId = actor.connect('destroy', Lang.bind(this, function() {
+ this._initialKeyFocusDestroyId = actor.connect('destroy', () => {
this._initialKeyFocus = null;
this._initialKeyFocusDestroyId = 0;
- }));
+ });
},
open(timestamp, onPrimary) {
{ opacity: 0,
time: FADE_OUT_DIALOG_TIME,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this,
- function() {
- this.state = State.FADED_OUT;
- })
+ onComplete: () => {
+ this.state = State.FADED_OUT;
+ }
});
}
});
this.setIcon(this._icon);
this._prevButton = this.addMediaControl('media-skip-backward-symbolic',
- Lang.bind(this, function() {
+ () => {
this._player.previous();
- }));
+ });
this._playPauseButton = this.addMediaControl(null,
- Lang.bind(this, function() {
+ () => {
this._player.playPause();
- }));
+ });
this._nextButton = this.addMediaControl('media-skip-forward-symbolic',
- Lang.bind(this, function() {
+ () => {
this._player.next();
- }));
+ });
this._player.connect('changed', Lang.bind(this, this._update));
this._player.connect('closed', Lang.bind(this, this.close));
_onMprisProxyReady() {
this._ownerNotifyId = this._mprisProxy.connect('notify::g-name-owner',
- Lang.bind(this, function() {
+ () => {
if (!this._mprisProxy.g_name_owner)
this._close();
- }));
+ });
},
_onPlayerProxyReady() {
return;
let player = new MprisPlayer(busName);
- player.connect('closed', Lang.bind(this,
- function() {
+ player.connect('closed',
+ () => {
this._players.delete(busName);
- }));
- player.connect('show', Lang.bind(this,
- function() {
+ });
+ player.connect('show',
+ () => {
let message = new MediaMessage(player);
this.addMessage(message, true);
- }));
+ });
this._players.set(busName, player);
},
_onProxyReady() {
- this._proxy.ListNamesRemote(Lang.bind(this,
- function([names]) {
- names.forEach(Lang.bind(this,
- function(name) {
- if (!name.startsWith(MPRIS_PLAYER_PREFIX))
- return;
-
- this._addPlayer(name);
- }));
- }));
+ this._proxy.ListNamesRemote(([names]) => {
+ names.forEach(name => {
+ if (!name.startsWith(MPRIS_PLAYER_PREFIX))
+ return;
+
+ this._addPlayer(name);
+ });
+ });
this._proxy.connectSignal('NameOwnerChanged',
Lang.bind(this, this._onNameOwnerChanged));
},
source = new FdoNotificationDaemonSource(title, pid, sender, appId);
this._sources.push(source);
- source.connect('destroy', Lang.bind(this, function() {
+ source.connect('destroy', () => {
let index = this._sources.indexOf(source);
if (index >= 0)
this._sources.splice(index, 1);
- }));
+ });
Main.messageTray.add(source);
return source;
// Ignore replacesId since we already sent back a
// NotificationClosed for that id.
id = this._nextNotificationId++;
- let idle_id = Mainloop.idle_add(Lang.bind(this,
- function () {
- this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED);
- return GLib.SOURCE_REMOVE;
- }));
+ let idle_id = Mainloop.idle_add(() => {
+ this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED);
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(idle_id, '[gnome-shell] this._emitNotificationClosed');
return invocation.return_value(GLib.Variant.new('(u)', [id]));
}
return invocation.return_value(GLib.Variant.new('(u)', [id]));;
}
- this._busProxy.GetConnectionUnixProcessIDRemote(sender, Lang.bind(this, function (result, excp) {
+ this._busProxy.GetConnectionUnixProcessIDRemote(sender, (result, excp) => {
// The app may have updated or removed the notification
ndata = this._notifications[id];
if (!ndata)
source = this._getSource(appName, pid, ndata, sender, null);
this._senderToPid[sender] = pid;
- source.connect('destroy', Lang.bind(this, function() {
+ source.connect('destroy', () => {
delete this._senderToPid[sender];
- }));
+ });
this._notifyForSource(source, ndata);
- }));
+ });
return invocation.return_value(GLib.Variant.new('(u)', [id]));
},
if (notification == null) {
notification = new MessageTray.Notification(source);
ndata.notification = notification;
- notification.connect('destroy', Lang.bind(this,
- function(n, reason) {
- delete this._notifications[ndata.id];
- let notificationClosedReason;
- switch (reason) {
- case MessageTray.NotificationDestroyedReason.EXPIRED:
- notificationClosedReason = NotificationClosedReason.EXPIRED;
- break;
- case MessageTray.NotificationDestroyedReason.DISMISSED:
- notificationClosedReason = NotificationClosedReason.DISMISSED;
- break;
- case MessageTray.NotificationDestroyedReason.SOURCE_CLOSED:
- notificationClosedReason = NotificationClosedReason.APP_CLOSED;
- break;
- }
- this._emitNotificationClosed(ndata.id, notificationClosedReason);
- }));
+ notification.connect('destroy', (n, reason) => {
+ delete this._notifications[ndata.id];
+ let notificationClosedReason;
+ switch (reason) {
+ case MessageTray.NotificationDestroyedReason.EXPIRED:
+ notificationClosedReason = NotificationClosedReason.EXPIRED;
+ break;
+ case MessageTray.NotificationDestroyedReason.DISMISSED:
+ notificationClosedReason = NotificationClosedReason.DISMISSED;
+ break;
+ case MessageTray.NotificationDestroyedReason.SOURCE_CLOSED:
+ notificationClosedReason = NotificationClosedReason.APP_CLOSED;
+ break;
+ }
+ this._emitNotificationClosed(ndata.id, notificationClosedReason);
+ });
}
let gicon = this._iconForNotificationData(icon, hints);
if (actionId == 'default')
hasDefaultAction = true;
else
- notification.addAction(label, Lang.bind(this, function() {
+ notification.addAction(label, () => {
this._emitActionInvoked(ndata.id, actionId);
- }));
+ });
}
}
if (hasDefaultAction) {
- notification.connect('activated', Lang.bind(this, function() {
+ notification.connect('activated', () => {
this._emitActionInvoked(ndata.id, 'default');
- }));
+ });
} else {
- notification.connect('activated', Lang.bind(this, function() {
+ notification.connect('activated', () => {
source.open();
- }));
+ });
}
switch (hints.urgency) {
}
if (buttons) {
- buttons.deep_unpack().forEach(Lang.bind(this, function(button) {
+ buttons.deep_unpack().forEach(button => {
this.addAction(button.label.unpack(),
Lang.bind(this, this._onButtonClicked, button));
- }));
+ });
}
this._defaultAction = defaultAction ? defaultAction.unpack() : null;
},
activateAction(actionId, target) {
- this._createApp(function (app, error) {
+ this._createApp((app, error) => {
if (error == null)
app.ActivateActionRemote(actionId, target ? [target] : [], getPlatformData());
else
},
open() {
- this._createApp(function (app, error) {
+ this._createApp((app, error) => {
if (error == null)
app.ActivateRemote(getPlatformData());
else
this._notifications[notificationId].destroy();
let notification = new GtkNotificationDaemonNotification(this, notificationParams);
- notification.connect('destroy', Lang.bind(this, function() {
+ notification.connect('destroy', () => {
delete this._notifications[notificationId];
- }));
+ });
this._notifications[notificationId] = notification;
if (showBanner)
let source = new GtkNotificationDaemonAppSource(appId);
- source.connect('destroy', Lang.bind(this, function() {
+ source.connect('destroy', () => {
delete this._sources[appId];
this._saveNotifications();
- }));
+ });
source.connect('count-updated', Lang.bind(this, this._saveNotifications));
Main.messageTray.add(source);
this._sources[appId] = source;
let value = global.get_persistent_state('a(sa(sv))', 'notifications');
if (value) {
let sources = value.deep_unpack();
- sources.forEach(Lang.bind(this, function([appId, notifications]) {
+ sources.forEach(([appId, notifications]) => {
if (notifications.length == 0)
return;
return;
}
- notifications.forEach(function([notificationId, notification]) {
+ notifications.forEach(([notificationId, notification]) => {
source.addNotification(notificationId, notification.deep_unpack(), false);
});
- }));
+ });
}
this._isLoading = false;
this._client = client;
this._clientWatchId = Gio.bus_watch_name(Gio.BusType.SESSION, client, 0, null,
- Lang.bind(this, function(c, name) {
+ (c, name) => {
this.hide(name);
- }));
+ });
return true;
},
{ opacity: 0,
time: FADE_TIME,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this, function() {
+ onComplete: () => {
this._reset();
Meta.enable_unredirect_for_screen(global.screen);
- })
+ }
});
return GLib.SOURCE_REMOVE;
},
if (this._source == null) {
this._source = new MessageTray.SystemNotificationSource();
- this._source.connect('destroy', Lang.bind(this,
- function() {
- this._source = null;
- }));
+ this._source.connect('destroy', () => {
+ this._source = null;
+ });
Main.messageTray.add(this._source);
}
this._coverPane = new Clutter.Actor({ opacity: 0,
reactive: true });
Main.layoutManager.overviewGroup.add_child(this._coverPane);
- this._coverPane.connect('event', Lang.bind(this, function (actor, event) { return Clutter.EVENT_STOP; }));
+ this._coverPane.connect('event', () => Clutter.EVENT_STOP);
Main.layoutManager.overviewGroup.add_child(this._overview);
// TODO - recalculate everything when desktop size changes
this.dashIconSize = this._dash.iconSize;
- this._dash.connect('icon-size-changed',
- Lang.bind(this, function() {
- this.dashIconSize = this._dash.iconSize;
- }));
+ this._dash.connect('icon-size-changed', () => {
+ this.dashIconSize = this._dash.iconSize;
+ });
Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._relayout));
this._relayout();
if (targetIsWindow) {
this._lastHoveredWindow = dragEvent.targetActor._delegate.metaWindow;
this._windowSwitchTimeoutId = Mainloop.timeout_add(DND_WINDOW_SWITCH_TIMEOUT,
- Lang.bind(this, function() {
- this._windowSwitchTimeoutId = 0;
- this._needsFakePointerEvent = true;
- Main.activateWindow(dragEvent.targetActor._delegate.metaWindow,
- this._windowSwitchTimestamp);
- this.hide();
- this._lastHoveredWindow = null;
- return GLib.SOURCE_REMOVE;
- }));
+ () => {
+ this._windowSwitchTimeoutId = 0;
+ this._needsFakePointerEvent = true;
+ Main.activateWindow(dragEvent.targetActor._delegate.metaWindow,
+ this._windowSwitchTimestamp);
+ this.hide();
+ this._lastHoveredWindow = null;
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(this._windowSwitchTimeoutId, '[gnome-shell] Main.activateWindow');
}
},
_getDesktopClone() {
- let windows = global.get_window_actors().filter(function(w) {
- return w.meta_window.get_window_type() == Meta.WindowType.DESKTOP;
- });
+ let windows = global.get_window_actors().filter(
+ w => w.meta_window.get_window_type() == Meta.WindowType.DESKTOP
+ );
if (windows.length == 0)
return null;
let window = windows[0];
let clone = new Clutter.Clone({ source: window,
x: window.x, y: window.y });
- clone.source.connect('destroy', Lang.bind(this, function() {
+ clone.source.connect('destroy', () => {
clone.destroy();
- }));
+ });
return clone;
},
layout.connect('allocation-changed', Lang.bind(this, this._updateWorkspacesGeometry));
Main.overview.connect('showing', Lang.bind(this, this._updateSpacerVisibility));
- Main.overview.connect('item-drag-begin', Lang.bind(this,
- function() {
- let activePage = this.viewSelector.getActivePage();
- if (activePage != ViewSelector.ViewPage.WINDOWS)
- this.viewSelector.fadeHalf();
- }));
- Main.overview.connect('item-drag-end', Lang.bind(this,
- function() {
- this.viewSelector.fadeIn();
- }));
- Main.overview.connect('item-drag-cancelled', Lang.bind(this,
- function() {
- this.viewSelector.fadeIn();
- }));
+ Main.overview.connect('item-drag-begin', () => {
+ let activePage = this.viewSelector.getActivePage();
+ if (activePage != ViewSelector.ViewPage.WINDOWS)
+ this.viewSelector.fadeHalf();
+ });
+ Main.overview.connect('item-drag-end', () => {
+ this.viewSelector.fadeIn();
+ });
+ Main.overview.connect('item-drag-cancelled', () => {
+ this.viewSelector.fadeIn();
+ });
},
_updateWorkspacesGeometry() {
this._ensureMenu(groupDevices);
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
- this.actor.connect('clicked', Lang.bind(this, function (actor) {
+ this.actor.connect('clicked', actor => {
if (actor.get_checked()) {
if (this._padChooserMenu != null)
this._padChooserMenu.open(true);
} else {
this._padChooserMenu.close(true);
}
- }));
+ });
},
_ensureMenu(devices) {
this._padChooserMenu = new PopupMenu.PopupMenu(this.actor, 0.5, St.Side.TOP);
- this._padChooserMenu.connect('menu-closed', Lang.bind(this, function() { this.actor.set_checked(false); }));
+ this._padChooserMenu.connect('menu-closed', () => {
+ this.actor.set_checked(false);
+ });
this._padChooserMenu.actor.hide();
Main.uiGroup.add_actor(this._padChooserMenu.actor);
box.add_child(arrow);
this._editMenu = new PopupMenu.PopupMenu(this.actor, 0, St.Side.TOP);
- this._editMenu.connect('menu-closed', Lang.bind(this, function() { this.actor.set_checked(false); }));
+ this._editMenu.connect('menu-closed', () => {
+ this.actor.set_checked(false);
+ });
this._editMenu.actor.hide();
Main.uiGroup.add_actor(this._editMenu.actor);
for (let [action, label] of this._actionLabels.entries()) {
let selectedAction = action;
- let item = this._editMenu.addAction(label, Lang.bind(this, function() { this._onActionSelected(selectedAction) }));
+ let item = this._editMenu.addAction(label, () => {
+ this._onActionSelected(selectedAction);
+ });
/* These actions only apply to pad buttons */
if (selectedAction == GDesktopEnums.PadButtonAction.HELP ||
this._padChooser = null;
let deviceManager = Clutter.DeviceManager.get_default();
- this._deviceAddedId = deviceManager.connect('device-added', Lang.bind(this, function (manager, device) {
+ this._deviceAddedId = deviceManager.connect('device-added', (manager, device) => {
if (device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE &&
this.padDevice.is_grouped(device)) {
this._groupPads.push(device);
this._updatePadChooser();
}
- }));
- this._deviceRemovedId = deviceManager.connect('device-removed', Lang.bind(this, function (manager, device) {
+ });
+ this._deviceRemovedId = deviceManager.connect('device-removed', (manager, device) => {
// If the device is being removed, destroy the padOsd.
if (device == this.padDevice) {
this.destroy();
this._updatePadChooser();
}
- }));
+ });
- deviceManager.list_devices().forEach(Lang.bind(this, function(device) {
+ deviceManager.list_devices().forEach(device => {
if (device != this.padDevice &&
device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE &&
this.padDevice.is_grouped(device))
this._groupPads.push(device);
- }));
+ });
this.actor = new St.BoxLayout({ style_class: 'pad-osd-window',
x_expand: true,
style_class: 'button',
x_align: Clutter.ActorAlign.CENTER,
can_focus: true });
- this._editButton.connect('clicked', Lang.bind(this, function () { this.setEditionMode(true) }));
+ this._editButton.connect('clicked', () => {
+ this.setEditionMode(true);
+ });
buttonBox.add_actor(this._editButton);
this._syncEditionMode();
if (this._groupPads.length > 1) {
if (this._padChooser == null) {
this._padChooser = new PadChooser(this.padDevice, this._groupPads)
- this._padChooser.connect('pad-selected', Lang.bind(this, function (chooser, pad) {
+ this._padChooser.connect('pad-selected', (chooser, pad) => {
this._requestForOtherPad(pad);
- }));
+ });
this._titleBox.add_child(this._padChooser.actor);
} else {
this._padChooser.update(this._groupPads);
let devices = deviceManager.list_devices();
let padDevice = null;
- devices.forEach(Lang.bind(this, function(device) {
+ devices.forEach(device => {
if (deviceNode == device.get_device_node() &&
device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE)
padDevice = device;
- }));
+ });
if (padDevice == null) {
invocation.return_error_literal(Gio.IOErrorEnum,
_onAppStateChanged(appSys, app) {
let state = app.state;
- if (state != Shell.AppState.STARTING) {
- this._startingApps = this._startingApps.filter(function(a) {
- return a != app;
- });
- } else if (state == Shell.AppState.STARTING) {
+ if (state != Shell.AppState.STARTING)
+ this._startingApps = this._startingApps.filter(a => a != app);
+ else if (state == Shell.AppState.STARTING)
this._startingApps.push(app);
- }
// For now just resync on all running state changes; this is mainly to handle
// cases where the focused window's application changes without the focus
// changing. An example case is how we map OpenOffice.org based on the window
return;
menu = new RemoteMenu.RemoteMenu(this.actor, this._targetApp.menu, this._targetApp.action_group);
- menu.connect('activate', Lang.bind(this, function() {
+ menu.connect('activate', () => {
let win = this._targetApp.get_windows()[0];
win.check_alive(global.get_current_time());
- }));
+ });
} else {
if (this.menu && this.menu.isDummyQuitMenu)
// fallback to older menu
menu = new PopupMenu.PopupMenu(this.actor, 0.0, St.Side.TOP, 0);
menu.isDummyQuitMenu = true;
- menu.addAction(_("Quit"), Lang.bind(this, function() {
+ menu.addAction(_("Quit"), () => {
this._targetApp.request_quit();
- }));
+ });
}
this.setMenu(menu);
this.actor.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
this.actor.connect_after('key-release-event', Lang.bind(this, this._onKeyRelease));
- Main.overview.connect('showing', Lang.bind(this, function() {
+ Main.overview.connect('showing', () => {
this.actor.add_style_pseudo_class('overview');
this.actor.add_accessible_state (Atk.StateType.CHECKED);
- }));
- Main.overview.connect('hiding', Lang.bind(this, function() {
+ });
+ Main.overview.connect('hiding', () => {
this.actor.remove_style_pseudo_class('overview');
this.actor.remove_accessible_state (Atk.StateType.CHECKED);
- }));
+ });
this._xdndTimeOut = 0;
},
this._button = button;
- button.connect('destroy', Lang.bind(this,
- function() {
- if (this._button == button) {
- this._button = null;
- this._buttonStyleChangedSignalId = 0;
- }
- }));
+ button.connect('destroy', () => {
+ if (this._button == button) {
+ this._button = null;
+ this._buttonStyleChangedSignalId = 0;
+ }
+ });
// Synchronize the locate button's pseudo classes with this corner
- this._buttonStyleChangedSignalId = button.connect('style-changed', Lang.bind(this,
- function(actor) {
+ this._buttonStyleChangedSignalId = button.connect('style-changed',
+ actor => {
let pseudoClass = button.get_style_pseudo_class();
this.actor.set_style_pseudo_class(pseudoClass);
- }));
+ });
// The corner doesn't support theme transitions, so override
// the .panel-button default
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress));
- Main.overview.connect('showing', Lang.bind(this, function () {
+ Main.overview.connect('showing', () => {
this.actor.add_style_pseudo_class('overview');
this._updateSolidStyle();
- }));
- Main.overview.connect('hiding', Lang.bind(this, function () {
+ });
+ Main.overview.connect('hiding', () => {
this.actor.remove_style_pseudo_class('overview');
this._updateSolidStyle();
- }));
+ });
Main.layoutManager.panelBox.add(this.actor);
Main.ctrlAltTabManager.addGroup(this.actor, _("Top Bar"), 'focus-top-bar-symbolic',
/* Get all the windows in the active workspace that are in the primary monitor and visible */
let activeWorkspace = global.screen.get_active_workspace();
- let windows = activeWorkspace.list_windows().filter(function(metaWindow) {
+ let windows = activeWorkspace.list_windows().filter(metaWindow => {
return metaWindow.is_on_primary_monitor() &&
metaWindow.showing_on_its_workspace() &&
metaWindow.get_window_type() != Meta.WindowType.DESKTOP;
let [, panelTop] = this.actor.get_transformed_position();
let panelBottom = panelTop + this.actor.get_height();
let scale = St.ThemeContext.get_for_stage(global.stage).scale_factor;
- let isNearEnough = windows.some(Lang.bind(this, function(metaWindow) {
+ let isNearEnough = windows.some(metaWindow => {
let verticalPosition = metaWindow.get_frame_rect().y;
return verticalPosition < panelBottom + 5 * scale;
- }));
+ });
if (isNearEnough)
this._addStyleClassName('solid');
if (indicator.menu)
this.menuManager.addMenu(indicator.menu);
this.statusArea[role] = indicator;
- let destroyId = indicator.connect('destroy', Lang.bind(this, function(emitter) {
+ let destroyId = indicator.connect('destroy', emitter => {
delete this.statusArea[role];
emitter.disconnect(destroyId);
container.destroy();
- }));
+ });
indicator.connect('menu-set', Lang.bind(this, this._onMenuSet));
this._onMenuSet(indicator);
},
return;
indicator.menu._openChangedId = indicator.menu.connect('open-state-changed',
- Lang.bind(this, function(menu, isOpen) {
+ (menu, isOpen) => {
let boxAlignment;
if (this._leftBox.contains(indicator.container))
boxAlignment = Clutter.ActorAlign.START;
if (boxAlignment == Main.messageTray.bannerAlignment)
Main.messageTray.bannerBlocked = isOpen;
- }));
+ });
}
});
},
_syncIndicatorsVisible() {
- this.indicators.visible = this.indicators.get_children().some(function(actor) {
- return actor.visible;
- });
+ this.indicators.visible = this.indicators.get_children().some(a => a.visible);
},
_addIndicator() {
menuItem = new PopupMenuItem(title);
this.addMenuItem(menuItem);
- menuItem.connect('activate', Lang.bind(this, function (menuItem, event) {
+ menuItem.connect('activate', (menuItem, event) => {
callback(event);
- }));
+ });
return menuItem;
},
addSettingsAction(title, desktopFile) {
- let menuItem = this.addAction(title, function() {
- let app = Shell.AppSystem.get_default().lookup_app(desktopFile);
+ let menuItem = this.addAction(title, () => {
+ let app = Shell.AppSystem.get_default().lookup_app(desktopFile);
- if (!app) {
- log('Settings panel for desktop file ' + desktopFile + ' could not be loaded!');
- return;
- }
+ if (!app) {
+ log('Settings panel for desktop file ' + desktopFile + ' could not be loaded!');
+ return;
+ }
- Main.overview.hide();
- app.activate();
- });
+ Main.overview.hide();
+ app.activate();
+ });
menuItem.actor.visible = Main.sessionMode.allowSettings;
this._settingsActions[desktopFile] = menuItem;
},
isEmpty() {
- let hasVisibleChildren = this.box.get_children().some(function(child) {
+ let hasVisibleChildren = this.box.get_children().some(child => {
if (child._delegate instanceof PopupSeparatorMenuItem)
return false;
return isPopupMenuItemVisible(child);
},
_connectItemSignals(menuItem) {
- menuItem._activeChangeId = menuItem.connect('active-changed', Lang.bind(this, function (menuItem, active) {
+ menuItem._activeChangeId = menuItem.connect('active-changed', (menuItem, active) => {
if (active && this._activeMenuItem != menuItem) {
if (this._activeMenuItem)
this._activeMenuItem.setActive(false);
this._activeMenuItem = null;
this.emit('active-changed', null);
}
- }));
- menuItem._sensitiveChangeId = menuItem.connect('sensitive-changed', Lang.bind(this, function() {
+ });
+ menuItem._sensitiveChangeId = menuItem.connect('sensitive-changed', () => {
let sensitive = menuItem.getSensitive();
if (!sensitive && this._activeMenuItem == menuItem) {
if (!this.actor.navigate_focus(menuItem.actor,
if (global.stage.get_key_focus() == this.actor)
menuItem.actor.grab_key_focus();
}
- }));
- menuItem._activateId = menuItem.connect('activate', Lang.bind(this, function (menuItem, event) {
+ });
+ menuItem._activateId = menuItem.connect('activate', (menuItem, event) => {
this.emit('activate', menuItem);
this.itemActivated(BoxPointer.PopupAnimation.FULL);
- }));
+ });
- menuItem._parentSensitiveChangeId = this.connect('sensitive-changed', Lang.bind(this, function() {
+ menuItem._parentSensitiveChangeId = this.connect('sensitive-changed', () => {
menuItem.syncSensitive();
- }));
+ });
// the weird name is to avoid a conflict with some random property
// the menuItem may have, called destroyId
// (FIXME: in the future it may make sense to have container objects
// like PopupMenuManager does)
- menuItem._popupMenuDestroyId = menuItem.connect('destroy', Lang.bind(this, function(menuItem) {
+ menuItem._popupMenuDestroyId = menuItem.connect('destroy', menuItem => {
menuItem.disconnect(menuItem._popupMenuDestroyId);
menuItem.disconnect(menuItem._activateId);
menuItem.disconnect(menuItem._activeChangeId);
this.disconnect(menuItem._parentSensitiveChangeId);
if (menuItem == this._activeMenuItem)
this._activeMenuItem = null;
- }));
+ });
},
_updateSeparatorVisibility(menuItem) {
if (menuItem instanceof PopupMenuSection) {
let activeChangeId = menuItem.connect('active-changed', Lang.bind(this, this._subMenuActiveChanged));
- let parentOpenStateChangedId = this.connect('open-state-changed', function(self, open) {
+ let parentOpenStateChangedId = this.connect('open-state-changed', (self, open) => {
if (open)
menuItem.open();
else
menuItem.close();
});
- let parentClosingId = this.connect('menu-closed', function() {
+ let parentClosingId = this.connect('menu-closed', () => {
menuItem.emit('menu-closed');
});
- let subMenuSensitiveChangedId = this.connect('sensitive-changed', Lang.bind(this, function() {
+ let subMenuSensitiveChangedId = this.connect('sensitive-changed', () => {
menuItem.emit('sensitive-changed');
- }));
+ });
- menuItem.connect('destroy', Lang.bind(this, function() {
+ menuItem.connect('destroy', () => {
menuItem.disconnect(activeChangeId);
this.disconnect(subMenuSensitiveChangedId);
this.disconnect(parentOpenStateChangedId);
this.disconnect(parentClosingId);
this.length--;
- }));
+ });
} else if (menuItem instanceof PopupSubMenuMenuItem) {
if (before_item == null)
this.box.add(menuItem.menu.actor);
this._connectItemSignals(menuItem);
let subMenuActiveChangeId = menuItem.menu.connect('active-changed', Lang.bind(this, this._subMenuActiveChanged));
- let closingId = this.connect('menu-closed', function() {
+ let closingId = this.connect('menu-closed', () => {
menuItem.menu.close(BoxPointer.PopupAnimation.NONE);
});
- menuItem.connect('destroy', Lang.bind(this, function() {
+ menuItem.connect('destroy', () => {
menuItem.menu.disconnect(subMenuActiveChangeId);
this.disconnect(closingId);
- }));
+ });
} else if (menuItem instanceof PopupSeparatorMenuItem) {
this._connectItemSignals(menuItem);
// separator's adjacent siblings change visibility or position.
// open-state-changed isn't exactly that, but doing it in more
// precise ways would require a lot more bookkeeping.
- let openStateChangeId = this.connect('open-state-changed', Lang.bind(this, function() { this._updateSeparatorVisibility(menuItem); }));
- let destroyId = menuItem.connect('destroy', Lang.bind(this, function() {
+ let openStateChangeId = this.connect('open-state-changed', () => {
+ this._updateSeparatorVisibility(menuItem);
+ });
+ let destroyId = menuItem.connect('destroy', () => {
this.disconnect(openStateChangeId);
menuItem.disconnect(destroyId);
- }));
+ });
} else if (menuItem instanceof PopupBaseMenuItem)
this._connectItemSignals(menuItem);
else
},
_getMenuItems() {
- return this.box.get_children().map(function (actor) {
- return actor._delegate;
- }).filter(function(item) {
+ return this.box.get_children().map(a => a._delegate).filter(item => {
return item instanceof PopupBaseMenuItem || item instanceof PopupMenuSection;
});
},
this._activeMenuItem.setActive(false);
if (this._boxPointer.actor.visible) {
- this._boxPointer.hide(animate, Lang.bind(this, function() {
+ this._boxPointer.hide(animate, () => {
this.emit('menu-closed');
- }));
+ });
}
if (!this.isOpen)
if (source) {
if (!menu.blockSourceEvents)
this._grabHelper.addActor(source);
- menudata.enterId = source.connect('enter-event', Lang.bind(this, function() { return this._onMenuSourceEnter(menu); }));
- menudata.focusInId = source.connect('key-focus-in', Lang.bind(this, function() { this._onMenuSourceEnter(menu); }));
+ menudata.enterId = source.connect('enter-event',
+ () => this._onMenuSourceEnter(menu));
+ menudata.focusInId = source.connect('key-focus-in', () => {
+ this._onMenuSourceEnter(menu);
+ });
}
if (position == undefined)
this._trackerItem.connect('notify::label', Lang.bind(this, this._updateLabel));
this._updateLabel();
- this.menuItem.connect('destroy', function() {
+ this.menuItem.connect('destroy', () => {
trackerItem.run_dispose();
});
},
_insertItem.bind(null, this.menuItem.menu),
_removeItem.bind(null, this.menuItem.menu));
- this.menuItem.connect('request-open', Lang.bind(this, function(menu, open) {
+ this.menuItem.connect('request-open', (menu, open) => {
this._trackerItem.request_submenu_shown(open);
- }));
+ });
- this._trackerItem.connect('notify::submenu-shown', Lang.bind(this, function() {
+ this._trackerItem.connect('notify::submenu-shown', () => {
this.menuItem.setSubmenuShown(this._trackerItem.get_submenu_shown());
- }));
+ });
- this.menuItem.connect('destroy', function() {
+ this.menuItem.connect('destroy', () => {
trackerItem.run_dispose();
});
},
this.menuItem.actor.add_child(this._label);
this.menuItem.actor.label_actor = this._label;
- this.menuItem.connect('activate', Lang.bind(this, function() {
+ this.menuItem.connect('activate', () => {
this._trackerItem.activated();
- }));
+ });
this._trackerItem.bind_property('visible', this.menuItem.actor, 'visible', GObject.BindingFlags.SYNC_CREATE);
this._updateSensitivity();
this._updateRole();
- this.menuItem.connect('destroy', function() {
+ this.menuItem.connect('destroy', () => {
trackerItem.run_dispose();
});
},
// Special case gnome-control-center to be always active and always first
sortOrder.unshift('gnome-control-center.desktop');
- loadedProviders = loadedProviders.filter(function(provider) {
+ loadedProviders = loadedProviders.filter(provider => {
let appId = provider.appInfo.get_id();
if (provider.defaultEnabled) {
}
});
- loadedProviders.sort(function(providerA, providerB) {
+ loadedProviders.sort((providerA, providerB) => {
let idxA, idxB;
let appIdA, appIdB;
if (results.length <= maxNumber)
return results;
- let regularResults = results.filter(function(r) { return !r.startsWith('special:'); });
- let specialResults = results.filter(function(r) { return r.startsWith('special:'); });
+ let regularResults = results.filter(r => !r.startsWith('special:'));
+ let specialResults = results.filter(r => r.startsWith('special:'));
return regularResults.slice(0, maxNumber).concat(specialResults.slice(0, maxNumber));
},
this._lockdownSettings = new Gio.Settings({ schema_id: LOCKDOWN_SCHEMA });
this._terminalSettings = new Gio.Settings({ schema_id: TERMINAL_SCHEMA });
- global.settings.connect('changed::development-tools', Lang.bind(this, function () {
+ global.settings.connect('changed::development-tools', () => {
this._enableInternalCommands = global.settings.get_boolean('development-tools');
- }));
+ });
this._enableInternalCommands = global.settings.get_boolean('development-tools');
- this._internalCommands = { 'lg':
- Lang.bind(this, function() {
+ this._internalCommands = { 'lg': () => {
Main.createLookingGlass().open();
- }),
+ },
'r': Lang.bind(this, this._restart),
// Developer brain backwards compatibility
'restart': Lang.bind(this, this._restart),
- 'debugexit': Lang.bind(this, function() {
+ 'debugexit': () => {
Meta.quit(Meta.ExitCode.ERROR);
- }),
+ },
// rt is short for "reload theme"
- 'rt': Lang.bind(this, function() {
+ 'rt': () => {
Main.reloadThemeResource();
Main.loadTheme();
- })
+ }
};
this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY,
entry: this._entryText });
- this._entryText.connect('key-press-event', Lang.bind(this, function(o, e) {
+ this._entryText.connect('key-press-event', (o, e) => {
let symbol = e.get_key_symbol();
if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) {
this.popModal();
return Clutter.EVENT_STOP;
}
return Clutter.EVENT_PROPAGATE;
- }));
+ });
},
_getCommandCompletion(text) {
let paths = GLib.getenv('PATH').split(':');
paths.push(GLib.get_home_dir());
- let someResults = paths.map(function(path) {
+ let someResults = paths.map(path => {
let results = [];
try {
let file = Gio.File.new_for_path(path);
return results;
}
});
- let results = someResults.reduce(function(a, b) {
- return a.concat(b);
- }, []);
+ let results = someResults.reduce((a, b) => a.concat(b), []);
if (!results.length)
return null;
{ height: parentActor.height + errorBoxNaturalHeight,
time: DIALOG_GROW_TIME,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this,
- function() {
- parentActor.set_height(-1);
- this._errorBox.show();
- })
+ onComplete: () => {
+ parentActor.set_height(-1);
+ this._errorBox.show();
+ }
});
}
},
this.actor.add(this._scrollView, { x_fill: true, x_align: St.Align.START });
this._sources = new Map();
- Main.messageTray.getSources().forEach(Lang.bind(this, function(source) {
+ Main.messageTray.getSources().forEach(source => {
this._sourceAdded(Main.messageTray, source, true);
- }));
+ });
this._updateVisibility();
this._sourceAddedId = Main.messageTray.connect('source-added', Lang.bind(this, this._sourceAdded));
},
_updateVisibility() {
- this._notificationBox.visible = this._notificationBox.get_children().some(function(a) {
- return a.visible;
- });
+ this._notificationBox.visible =
+ this._notificationBox.get_children().some(a => a.visible);
this.actor.visible = this._notificationBox.visible;
},
this._showSource(source, obj, obj.sourceBox);
this._notificationBox.add(obj.sourceBox, { x_fill: false, x_align: St.Align.START });
- obj.sourceCountChangedId = source.connect('count-updated', Lang.bind(this, function(source) {
+ obj.sourceCountChangedId = source.connect('count-updated', source => {
this._countChanged(source, obj);
- }));
- obj.sourceTitleChangedId = source.connect('title-changed', Lang.bind(this, function(source) {
+ });
+ obj.sourceTitleChangedId = source.connect('title-changed', source => {
this._titleChanged(source, obj);
- }));
- obj.policyChangedId = source.policy.connect('policy-changed', Lang.bind(this, function(policy, key) {
+ });
+ obj.policyChangedId = source.policy.connect('policy-changed', (policy, key) => {
if (key == 'show-in-lock-screen')
this._visibleChanged(source, obj);
else
this._detailedChanged(source, obj);
- }));
- obj.sourceDestroyId = source.connect('destroy', Lang.bind(this, function(source) {
+ });
+ obj.sourceDestroyId = source.connect('destroy', source => {
this._onSourceDestroy(source, obj);
- }));
+ });
this._sources.set(source, obj);
this.actor.add_actor(this._lockDialogGroup);
this.actor.add_actor(this._lockScreenGroup);
- this._presence = new GnomeSession.Presence(Lang.bind(this, function(proxy, error) {
+ this._presence = new GnomeSession.Presence((proxy, error) => {
if (error) {
logError(error, 'Error while reading gnome-session presence');
return;
}
this._onStatusChanged(proxy.status);
- }));
- this._presence.connectSignal('StatusChanged', Lang.bind(this, function(proxy, senderName, [status]) {
+ });
+ this._presence.connectSignal('StatusChanged', (proxy, senderName, [status]) => {
this._onStatusChanged(status);
- }));
+ });
this._screenSaverDBus = new ShellDBus.ScreenSaverDBus(this);
this._smartcardManager = SmartcardManager.getSmartcardManager();
this._smartcardManager.connect('smartcard-inserted',
- Lang.bind(this, function(manager, token) {
+ (manager, token) => {
if (this._isLocked && token.UsedToLogin)
this._liftShield(true, 0);
- }));
+ });
this._oVirtCredentialsManager = OVirt.getOVirtCredentialsManager();
this._oVirtCredentialsManager.connect('user-authenticated',
- Lang.bind(this, function() {
+ () => {
if (this._isLocked)
this._liftShield(true, 0);
- }));
+ });
this._loginManager = LoginManager.getLoginManager();
this._loginManager.connect('prepare-for-sleep',
Lang.bind(this, this._prepareForSleep));
this._loginSession = null;
- this._loginManager.getCurrentSessionProxy(Lang.bind(this,
- function(sessionProxy) {
- this._loginSession = sessionProxy;
- this._loginSession.connectSignal('Lock', Lang.bind(this, function() { this.lock(false); }));
- this._loginSession.connectSignal('Unlock', Lang.bind(this, function() { this.deactivate(false); }));
- this._loginSession.connect('g-properties-changed', Lang.bind(this, this._syncInhibitor));
- this._syncInhibitor();
- }));
+ this._loginManager.getCurrentSessionProxy(sessionProxy => {
+ this._loginSession = sessionProxy;
+ this._loginSession.connectSignal('Lock',
+ () => { this.lock(false); });
+ this._loginSession.connectSignal('Unlock',
+ () => { this.deactivate(false); });
+ this._loginSession.connect('g-properties-changed', Lang.bind(this, this._syncInhibitor));
+ this._syncInhibitor();
+ });
this._settings = new Gio.Settings({ schema_id: SCREENSAVER_SCHEMA });
this._settings.connect('changed::' + LOCK_ENABLED_KEY, Lang.bind(this, this._syncInhibitor));
!this._isActive && lockEnabled && !lockLocked);
if (inhibit) {
this._loginManager.inhibit(_("GNOME needs to lock the screen"),
- Lang.bind(this, function(inhibitor) {
- if (this._inhibitor)
- this._inhibitor.close(null);
- this._inhibitor = inhibitor;
- }));
+ inhibitor => {
+ if (this._inhibitor)
+ this._inhibitor.close(null);
+ this._inhibitor = inhibitor;
+ });
} else {
if (this._inhibitor)
this._inhibitor.close(null);
if (shouldLock) {
let lockTimeout = Math.max(STANDARD_FADE_TIME, this._settings.get_uint(LOCK_DELAY_KEY));
this._lockTimeoutId = Mainloop.timeout_add(lockTimeout * 1000,
- Lang.bind(this, function() {
+ () => {
this._lockTimeoutId = 0;
this.lock(false);
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(this._lockTimeoutId, '[gnome-shell] this.lock');
}
this._checkArrowAnimation();
- let motionId = global.stage.connect('captured-event', Lang.bind(this, function(stage, event) {
+ let motionId = global.stage.connect('captured-event', (stage, event) => {
if (event.type() == Clutter.EventType.MOTION) {
this._cursorTracker.set_pointer_visible(true);
global.stage.disconnect(motionId);
}
return Clutter.EVENT_PROPAGATE;
- }));
+ });
this._cursorTracker.set_pointer_visible(false);
this._lockScreenState = MessageTray.State.SHOWN;
if (params.fadeToBlack && params.animateFade) {
// Take a beat
- let id = Mainloop.timeout_add(1000 * MANUAL_FADE_TIME, Lang.bind(this, function() {
+ let id = Mainloop.timeout_add(1000 * MANUAL_FADE_TIME, () => {
this._activateFade(this._shortLightbox, MANUAL_FADE_TIME);
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(id, '[gnome-shell] this._activateFade');
} else {
if (params.fadeToBlack)
deactivate(animate) {
if (this._dialog)
- this._dialog.finish(Lang.bind(this, function() {
- this._continueDeactivate(animate);
- }));
+ this._dialog.finish(() => { this._continueDeactivate(animate); });
else
this._continueDeactivate(animate);
},
let wasLocked = global.get_runtime_state('b', LOCKED_STATE_STR);
if (wasLocked === null)
return;
- Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
+ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this.lock(false);
- }));
+ });
}
});
Signals.addSignalMethods(ScreenShield.prototype);
if (result) {
if (flash) {
let flashspot = new Flashspot(area);
- flashspot.fire(Lang.bind(this, function() {
+ flashspot.fire(() => {
this._removeShooterForSender(invocation.get_sender());
- }));
+ });
}
else
this._removeShooterForSender(invocation.get_sender());
SelectAreaAsync(params, invocation) {
let selectArea = new SelectArea();
selectArea.show();
- selectArea.connect('finished', Lang.bind(this,
- function(selectArea, areaRectangle) {
- if (areaRectangle) {
- let retRectangle = this._unscaleArea(areaRectangle.x, areaRectangle.y,
- areaRectangle.width, areaRectangle.height);
- let retval = GLib.Variant.new('(iiii)', retRectangle);
- invocation.return_value(retval);
- } else {
- invocation.return_error_literal(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED,
- "Operation was cancelled");
- }
- }));
+ selectArea.connect('finished', (selectArea, areaRectangle) => {
+ if (areaRectangle) {
+ let retRectangle = this._unscaleArea(areaRectangle.x, areaRectangle.y,
+ areaRectangle.width, areaRectangle.height);
+ let retval = GLib.Variant.new('(iiii)', retRectangle);
+ invocation.return_value(retval);
+ } else {
+ invocation.return_error_literal(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED,
+ "Operation was cancelled");
+ }
+ });
},
FlashAreaAsync(params, invocation) {
{ opacity: 0,
time: 0.2,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this,
- function() {
- this._grabHelper.ungrab();
- })
+ onComplete: () => {
+ this._grabHelper.ungrab();
+ }
});
return Clutter.EVENT_PROPAGATE;
},
global.screen.set_cursor(Meta.Cursor.DEFAULT);
this.emit('finished', this._result);
- GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this,
- function() {
- this._group.destroy();
- return GLib.SOURCE_REMOVE;
- }));
+ GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
+ this._group.destroy();
+ return GLib.SOURCE_REMOVE;
+ });
}
});
Signals.addSignalMethods(SelectArea.prototype);
{ opacity: 0,
time: FLASHSPOT_ANIMATION_OUT_TIME,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this, function() {
+ onComplete: () => {
if (doneCallback)
doneCallback();
this.destroy();
- })
+ }
});
}
});
function sleep(milliseconds) {
let cb;
- let id = Mainloop.timeout_add(milliseconds, function() {
- if (cb)
- cb();
- return GLib.SOURCE_REMOVE;
- });
+ let id = Mainloop.timeout_add(milliseconds, () => {
+ if (cb)
+ cb();
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(id, '[gnome-shell] sleep');
- return function(callback) {
- cb = callback;
- };
+ return callback => { cb = callback; };
}
/**
function waitLeisure() {
let cb;
- global.run_at_leisure(function() {
- if (cb)
- cb();
- });
+ global.run_at_leisure(() => {
+ if (cb)
+ cb();
+ });
- return function(callback) {
- cb = callback;
- };
+ return callback => { cb = callback; };
}
const PerfHelperIface = '<node> \
let cb;
let errcb;
- args.push(function(result, excp) {
- if (excp) {
- if (errcb)
- errcb(excp);
- } else {
- if (cb)
- cb();
- }
- });
+ args.push((result, excp) => {
+ if (excp) {
+ if (errcb)
+ errcb(excp);
+ } else {
+ if (cb)
+ cb();
+ }
+ });
method.apply(obj, args);
- return function(callback, error_callback) {
+ return (callback, error_callback) => {
cb = callback;
errcb = error_callback;
};
function _step(g, finish, onError) {
try {
let waitFunction = g.next();
- waitFunction(function() {
+ waitFunction(() => {
_step(g, finish, onError);
},
- function(err) {
+ err => {
if (onError)
onError(err);
});
}
Shell.PerfLog.get_default().replay(
- function(time, eventName, signature, arg) {
+ (time, eventName, signature, arg) => {
if (eventName in eventHandlers)
eventHandlers[eventName](time, arg);
});
let g = scriptModule.run();
_step(g,
- function() {
+ () => {
try {
_collect(scriptModule, outputFile);
} catch (err) {
}
Meta.exit(Meta.ExitCode.SUCCESS);
},
- function(err) {
+ err => {
log("Script failed: " + err + "\n" + err.stack);
Meta.exit(Meta.ExitCode.ERROR);
});
},
_ensureResultActors(results, callback) {
- let metasNeeded = results.filter(Lang.bind(this, function(resultId) {
- return this._resultDisplays[resultId] === undefined;
- }));
+ let metasNeeded = results.filter(
+ resultId => this._resultDisplays[resultId] === undefined
+ );
if (metasNeeded.length === 0) {
callback(true);
this._cancellable.cancel();
this._cancellable.reset();
- this.provider.getResultMetas(metasNeeded, Lang.bind(this, function(metas) {
+ this.provider.getResultMetas(metasNeeded, metas => {
if (metas.length != metasNeeded.length) {
log('Wrong number of result metas returned by search provider ' + this.provider.id +
': expected ' + metasNeeded.length + ' but got ' + metas.length);
callback(false);
return;
}
- if (metas.some(function(meta) {
- return !meta.name || !meta.id;
- })) {
+ if (metas.some(meta => !meta.name || !meta.id)) {
log('Invalid result meta returned from search provider ' + this.provider.id);
callback(false);
return;
}
- metasNeeded.forEach(Lang.bind(this, function(resultId, i) {
+ metasNeeded.forEach((resultId, i) => {
let meta = metas[i];
let display = this._createResultDisplay(meta);
display.connect('activate', Lang.bind(this, this._activateResult));
display.actor.connect('key-focus-in', Lang.bind(this, this._keyFocusIn));
this._resultDisplays[resultId] = display;
- }));
+ });
callback(true);
- }), this._cancellable);
+ }, this._cancellable);
}
},
let results = this.provider.filterResults(providerResults, maxResults);
let moreCount = Math.max(providerResults.length - results.length, 0);
- this._ensureResultActors(results, Lang.bind(this, function(successful) {
+ this._ensureResultActors(results, successful => {
if (!successful) {
this._clearResultDisplay();
callback();
// content while filling in the results.
this.actor.hide();
this._clearResultDisplay();
- results.forEach(Lang.bind(this, function(resultId) {
+ results.forEach(resultId => {
this._addItem(this._resultDisplays[resultId]);
- }));
+ });
this._setMoreCount(this.provider.canLaunchSearch ? moreCount : 0);
this.actor.show();
callback();
- }));
+ });
}
}
});
this._container = new St.BoxLayout({ style_class: 'search-section-content' });
this.providerInfo = new ProviderInfo(provider);
this.providerInfo.connect('key-focus-in', Lang.bind(this, this._keyFocusIn));
- this.providerInfo.connect('clicked', Lang.bind(this,
- function() {
- this.providerInfo.animateLaunch();
- provider.launchSearch(this._terms);
- Main.overview.toggle();
- }));
+ this.providerInfo.connect('clicked', () => {
+ this.providerInfo.animateLaunch();
+ provider.launchSearch(this._terms);
+ Main.overview.toggle();
+ });
this._container.add(this.providerInfo, { x_fill: false,
y_fill: false,
},
_reloadRemoteProviders() {
- let remoteProviders = this._providers.filter(function(provider) {
- return provider.isRemoteProvider;
- });
- remoteProviders.forEach(Lang.bind(this, function(provider) {
+ let remoteProviders = this._providers.filter(p => p.isRemoteProvider);
+ remoteProviders.forEach(provider => {
this._unregisterProvider(provider);
- }));
+ });
- RemoteSearch.loadRemoteSearchProviders(this._searchSettings, Lang.bind(this, function(providers) {
+ RemoteSearch.loadRemoteSearchProviders(this._searchSettings, providers => {
providers.forEach(Lang.bind(this, this._registerProvider));
- }));
+ });
},
_registerProvider(provider) {
let previousResults = this._results;
this._results = {};
- this._providers.forEach(Lang.bind(this, function(provider) {
+ this._providers.forEach(provider => {
provider.searchInProgress = true;
let previousProviderResults = previousResults[provider.id];
provider.getSubsearchResultSet(previousProviderResults, this._terms, Lang.bind(this, this._gotResults, provider), this._cancellable);
else
provider.getInitialResultSet(this._terms, Lang.bind(this, this._gotResults, provider), this._cancellable);
- }));
+ });
this._updateSearchProgress();
},
_clearDisplay() {
- this._providers.forEach(function(provider) {
+ this._providers.forEach(provider => {
provider.display.clear();
});
},
if (this._startingSearch)
return true;
- return this._providers.some(function(provider) {
- return provider.searchInProgress;
- });
+ return this._providers.some(p => p.searchInProgress);
},
_updateSearchProgress() {
- let haveResults = this._providers.some(function(provider) {
+ let haveResults = this._providers.some(provider => {
let display = provider.display;
return (display.getFirstResult() != null);
});
let terms = this._terms;
let display = provider.display;
- display.updateSearch(results, terms, Lang.bind(this, function() {
+ display.updateSearch(results, terms, () => {
provider.searchInProgress = false;
this._maybeSetInitialSelection();
this._updateSearchProgress();
- }));
+ });
},
activateDefault() {
function listModes() {
_loadModes();
- let id = Mainloop.idle_add(function() {
+ let id = Mainloop.idle_add(() => {
let names = Object.getOwnPropertyNames(_modes);
for (let i = 0; i < names.length; i++)
if (_modes[names[i]].isPrimary)
this._grabbedAccelerators = new Map();
this._grabbers = new Map();
- global.display.connect('accelerator-activated', Lang.bind(this,
- function(display, action, deviceid, timestamp) {
+ global.display.connect('accelerator-activated',
+ (display, action, deviceid, timestamp) => {
this._emitAcceleratorActivated(action, deviceid, timestamp);
- }));
+ });
this._cachedOverviewVisible = false;
Main.overview.connect('showing',
// Only serialize the properties that we actually need.
const serializedProperties = ["type", "state", "path", "error", "hasPrefs"];
- serializedProperties.forEach(function(prop) {
+ serializedProperties.forEach(prop => {
obj[prop] = extension[prop];
});
this.parent();
this._screenShield = screenShield;
- screenShield.connect('active-changed', Lang.bind(this, function(shield) {
+ screenShield.connect('active-changed', shield => {
this._dbusImpl.emit_signal('ActiveChanged', GLib.Variant.new('(b)', [shield.active]));
- }));
- screenShield.connect('wake-up-screen', Lang.bind(this, function(shield) {
+ });
+ screenShield.connect('wake-up-screen', shield => {
this._dbusImpl.emit_signal('WakeUpScreen', null);
- }));
+ });
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(ScreenSaverIface, this);
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/ScreenSaver');
},
LockAsync(parameters, invocation) {
- let tmpId = this._screenShield.connect('lock-screen-shown', Lang.bind(this, function() {
+ let tmpId = this._screenShield.connect('lock-screen-shown', () => {
this._screenShield.disconnect(tmpId);
invocation.return_value(null);
- }));
+ });
this._screenShield.lock(true);
},
},
_updatePasteItem() {
- this._clipboard.get_text(St.ClipboardType.CLIPBOARD, Lang.bind(this,
- function(clipboard, text) {
+ this._clipboard.get_text(St.ClipboardType.CLIPBOARD,
+ (clipboard, text) => {
this._pasteItem.setSensitive(text && text != '');
- }));
+ });
},
_updatePasswordItem() {
},
_onPasteActivated() {
- this._clipboard.get_text(St.ClipboardType.CLIPBOARD, Lang.bind(this,
- function(clipboard, text) {
+ this._clipboard.get_text(St.ClipboardType.CLIPBOARD,
+ (clipboard, text) => {
if (!text)
return;
this._entry.clutter_text.delete_selection();
let pos = this._entry.clutter_text.get_cursor_position();
this._entry.clutter_text.insert_text(text, pos);
- }));
+ });
},
_onPasswordActivated() {
entry.connect('popup-menu', Lang.bind(null, _onPopup, entry));
- entry.connect('destroy', function() {
+ entry.connect('destroy', () => {
entry.menu.destroy();
entry.menu = null;
entry._menuManager = null;
this._closeExistingDialog();
this._dialog = new ShellMountQuestionDialog(this._gicon);
- this._dialogId = this._dialog.connect('response', Lang.bind(this,
- function(object, choice) {
+ this._dialogId = this._dialog.connect('response',
+ (object, choice) => {
this.mountOp.set_choice(choice);
this.mountOp.reply(Gio.MountOperationResult.HANDLED);
this.close();
- }));
+ });
this._dialog.update(message, choices);
this._dialog.open();
this._dialog = new ShellMountPasswordDialog(message, this._gicon, flags);
}
- this._dialogId = this._dialog.connect('response', Lang.bind(this,
- function(object, choice, password, remember) {
+ this._dialogId = this._dialog.connect('response',
+ (object, choice, password, remember) => {
if (choice == -1) {
this.mountOp.reply(Gio.MountOperationResult.ABORTED);
} else {
this.mountOp.set_password(password);
this.mountOp.reply(Gio.MountOperationResult.HANDLED);
}
- }));
+ });
this._dialog.open();
},
this._processesDialog = new ShellProcessesDialog(this._gicon);
this._dialog = this._processesDialog;
- this._dialogId = this._processesDialog.connect('response', Lang.bind(this,
- function(object, choice) {
+ this._dialogId = this._processesDialog.connect('response',
+ (object, choice) => {
if (choice == -1) {
this.mountOp.reply(Gio.MountOperationResult.ABORTED);
} else {
}
this.close();
- }));
+ });
this._processesDialog.open();
}
this._applicationList = new St.BoxLayout({ vertical: true });
scrollView.add_actor(this._applicationList);
- this._applicationList.connect('actor-added',
- Lang.bind(this, function() {
- if (this._applicationList.get_n_children() == 1)
- scrollView.show();
- }));
-
- this._applicationList.connect('actor-removed',
- Lang.bind(this, function() {
- if (this._applicationList.get_n_children() == 0)
- scrollView.hide();
- }));
+ this._applicationList.connect('actor-added', () => {
+ if (this._applicationList.get_n_children() == 1)
+ scrollView.show();
+ });
+
+ this._applicationList.connect('actor-removed', () => {
+ if (this._applicationList.get_n_children() == 0)
+ scrollView.hide();
+ });
},
_setAppsForPids(pids) {
// remove all the items
this._applicationList.destroy_all_children();
- pids.forEach(Lang.bind(this, function(pid) {
+ pids.forEach(pid => {
let tracker = Shell.WindowTracker.get_default();
let app = tracker.get_app_from_pid(pid);
let item = new ListItem(app);
this._applicationList.add(item.actor, { x_fill: true });
- item.connect('activate',
- Lang.bind(this, function() {
- // use -1 to indicate Cancel
- this.emit('response', -1);
- }));
- }));
+ item.connect('activate', () => {
+ // use -1 to indicate Cancel
+ this.emit('response', -1);
+ });
+ });
},
update(message, processes, choices) {
this._closeDialog();
this._dialog = new ShellMountPasswordDialog(message, this._createGIcon(iconName), flags);
- this._dialog.connect('response', Lang.bind(this,
- function(object, choice, password, remember) {
+ this._dialog.connect('response',
+ (object, choice, password, remember) => {
let details = {};
let response;
}
this._clearCurrentRequest(response, details);
- }));
+ });
this._dialog.open();
},
this._closeDialog();
this._dialog = new ShellMountQuestionDialog(this._createGIcon(iconName), message);
- this._dialog.connect('response', Lang.bind(this,
- function(object, choice) {
- this._clearCurrentRequest(Gio.MountOperationResult.HANDLED,
- { choice: GLib.Variant.new('i', choice) });
- }));
+ this._dialog.connect('response', (object, choice) => {
+ this._clearCurrentRequest(Gio.MountOperationResult.HANDLED,
+ { choice: GLib.Variant.new('i', choice) });
+ });
this._dialog.update(message, choices);
this._dialog.open();
this._closeDialog();
this._dialog = new ShellProcessesDialog(this._createGIcon(iconName));
- this._dialog.connect('response', Lang.bind(this,
- function(object, choice) {
- let response;
- let details = {};
-
- if (choice == -1) {
- response = Gio.MountOperationResult.ABORTED;
- } else {
- response = Gio.MountOperationResult.HANDLED;
- details['choice'] = GLib.Variant.new('i', choice);
- }
-
- this._clearCurrentRequest(response, details);
- }));
+ this._dialog.connect('response', (object, choice) => {
+ let response;
+ let details = {};
+
+ if (choice == -1) {
+ response = Gio.MountOperationResult.ABORTED;
+ } else {
+ response = Gio.MountOperationResult.HANDLED;
+ details['choice'] = GLib.Variant.new('i', choice);
+ }
+
+ this._clearCurrentRequest(response, details);
+ });
this._dialog.update(message, applicationPids, choices);
this._dialog.open();
let alwaysShow = this._a11ySettings.get_boolean(KEY_ALWAYS_SHOW);
let items = this.menu._getMenuItems();
- this.actor.visible = alwaysShow || items.some(function(f) { return !!f.state; });
+ this.actor.visible = alwaysShow || items.some(f => !!f.state);
return GLib.SOURCE_REMOVE;
},
if (!writable)
widget.actor.reactive = false;
else
- widget.connect('toggled', function(item) {
+ widget.connect('toggled', item => {
on_set(item.state);
});
return widget;
_buildItem(string, schema, key) {
let settings = new Gio.Settings({ schema_id: schema });
- settings.connect('changed::'+key, Lang.bind(this, function() {
+ settings.connect('changed::'+key, () => {
widget.setToggleState(settings.get_boolean(key));
this._queueSyncMenuVisibility();
- }));
+ });
let widget = this._buildItemExtended(string,
settings.get_boolean(key),
settings.is_writable(key),
- function(enabled) {
- return settings.set_boolean(key, enabled);
- });
+ enabled => settings.set_boolean(key, enabled));
return widget;
},
_buildHCItem() {
let interfaceSettings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
let wmSettings = new Gio.Settings({ schema_id: WM_SCHEMA });
- interfaceSettings.connect('changed::' + KEY_GTK_THEME, Lang.bind(this, function() {
+ interfaceSettings.connect('changed::' + KEY_GTK_THEME, () => {
let value = interfaceSettings.get_string(KEY_GTK_THEME);
if (value == HIGH_CONTRAST_THEME) {
highContrast.setToggleState(true);
}
this._queueSyncMenuVisibility();
- }));
- interfaceSettings.connect('changed::' + KEY_ICON_THEME, function() {
+ });
+ interfaceSettings.connect('changed::' + KEY_ICON_THEME, () => {
let value = interfaceSettings.get_string(KEY_ICON_THEME);
if (value != HIGH_CONTRAST_THEME)
iconTheme = value;
});
- wmSettings.connect('changed::' + KEY_WM_THEME, function() {
+ wmSettings.connect('changed::' + KEY_WM_THEME, () => {
let value = wmSettings.get_string(KEY_WM_THEME);
if (value != HIGH_CONTRAST_THEME)
wmTheme = value;
interfaceSettings.is_writable(KEY_GTK_THEME) &&
interfaceSettings.is_writable(KEY_ICON_THEME) &&
wmSettings.is_writable(KEY_WM_THEME),
- function (enabled) {
+ enabled => {
if (enabled) {
interfaceSettings.set_string(KEY_GTK_THEME, HIGH_CONTRAST_THEME);
interfaceSettings.set_string(KEY_ICON_THEME, HIGH_CONTRAST_THEME);
_buildFontItem() {
let settings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
- settings.connect('changed::' + KEY_TEXT_SCALING_FACTOR, Lang.bind(this, function() {
+ settings.connect('changed::' + KEY_TEXT_SCALING_FACTOR, () => {
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
let active = (factor > 1.0);
widget.setToggleState(active);
this._queueSyncMenuVisibility();
- }));
+ });
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
let initial_setting = (factor > 1.0);
let widget = this._buildItemExtended(_("Large Text"),
initial_setting,
settings.is_writable(KEY_TEXT_SCALING_FACTOR),
- function (enabled) {
+ enabled => {
if (enabled)
settings.set_double(KEY_TEXT_SCALING_FACTOR,
DPI_FACTOR_LARGE);
this._hadSetupDevices = global.settings.get_boolean(HAD_BLUETOOTH_DEVICES_SETUP);
this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
- Lang.bind(this, function(proxy, error) {
+ (proxy, error) => {
if (error) {
log(error.message);
return;
}
this._sync();
- }));
+ });
this._proxy.connect('g-properties-changed', Lang.bind(this, this._sync));
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Bluetooth"), true);
this._item.icon.icon_name = 'bluetooth-active-symbolic';
this._toggleItem = new PopupMenu.PopupMenuItem('');
- this._toggleItem.connect('activate', Lang.bind(this, function() {
+ this._toggleItem.connect('activate', () => {
this._proxy.BluetoothAirplaneMode = !this._proxy.BluetoothAirplaneMode;
- }));
+ });
this._item.menu.addMenuItem(this._toggleItem);
this._item.menu.addSettingsAction(_("Bluetooth Settings"), 'gnome-bluetooth-panel.desktop');
_init() {
this.parent('display-brightness-symbolic');
this._proxy = new BrightnessProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
- Lang.bind(this, function(proxy, error) {
+ (proxy, error) => {
if (error) {
log(error.message);
return;
this._proxy.connect('g-properties-changed', Lang.bind(this, this._sync));
this._sync();
- }));
+ });
this._item = new PopupMenu.PopupBaseMenuItem({ activate: false });
this.menu.addMenuItem(this._item);
style_class: 'popup-menu-icon' });
this._item.actor.add(icon);
this._item.actor.add(this._slider.actor, { expand: true });
- this._item.actor.connect('button-press-event', Lang.bind(this, function(actor, event) {
+ this._item.actor.connect('button-press-event', (actor, event) => {
return this._slider.startDragging(event);
- }));
- this._item.actor.connect('key-press-event', Lang.bind(this, function(actor, event) {
+ });
+ this._item.actor.connect('key-press-event', (actor, event) => {
return this._slider.onKeyPressEvent(actor, event);
- }));
+ });
},
'GetAll',
new GLib.Variant('(s)', [this._BUS_IFACE]),
null, Gio.DBusCallFlags.NONE, -1, null,
- Lang.bind(this, function(conn, result) {
+ (conn, result) => {
let props;
try {
props = conn.call_finish(result).deep_unpack()[0];
this._options = options;
this._emitKeyboardOptionsChanged();
}
- }));
+ });
},
get inputSources() {
for (let i in this._inputSources)
sourcesList.push(this._inputSources[i]);
- this._keyboardManager.setUserLayouts(sourcesList.map(function(x) { return x.xkbId; }));
+ this._keyboardManager.setUserLayouts(sourcesList.map(x => x.xkbId));
if (!this._disableIBus && this._mruSourcesBackup) {
this._mruSources = this._mruSourcesBackup;
Main.overview.disconnect(this._overviewHiddenId);
this._overviewHiddenId = 0;
- let windows = global.get_window_actors().map(function(w) {
- return w.meta_window;
- });
+ let windows = global.get_window_actors().map(w => w.meta_window);
for (let i = 0; i < windows.length; ++i) {
delete windows[i]._inputSources;
delete windows[i]._currentSource;
let is = this._inputSourceManager.inputSources[i];
let menuItem = new LayoutMenuItem(is.displayName, is.shortName);
- menuItem.connect('activate', function() {
- is.activate(true);
- });
+ menuItem.connect('activate', () => { is.activate(true); });
let indicatorLabel = new St.Label({ text: is.shortName,
visible: false });
this._menuItems[i] = menuItem;
this._indicatorLabels[i] = indicatorLabel;
- is.connect('changed', function() {
+ is.connect('changed', () => {
menuItem.indicator.set_text(is.shortName);
indicatorLabel.set_text(is.shortName);
});
item.radioGroup = radioGroup;
item.setOrnament(prop.get_state() == IBus.PropState.CHECKED ?
PopupMenu.Ornament.DOT : PopupMenu.Ornament.NONE);
- item.connect('activate', Lang.bind(this, function() {
+ item.connect('activate', () => {
if (item.prop.get_state() == IBus.PropState.CHECKED)
return;
IBus.PropState.UNCHECKED);
}
}
- }));
+ });
break;
case IBus.PropType.TOGGLE:
item = new PopupMenu.PopupSwitchMenuItem(prop.get_label().get_text(), prop.get_state() == IBus.PropState.CHECKED);
item.prop = prop;
- item.connect('toggled', Lang.bind(this, function() {
+ item.connect('toggled', () => {
if (item.state) {
item.prop.set_state(IBus.PropState.CHECKED);
ibusManager.activateProperty(item.prop.get_key(),
ibusManager.activateProperty(item.prop.get_key(),
IBus.PropState.UNCHECKED);
}
- }));
+ });
break;
case IBus.PropType.NORMAL:
item = new PopupMenu.PopupMenuItem(prop.get_label().get_text());
item.prop = prop;
- item.connect('activate', Lang.bind(this, function() {
+ item.connect('activate', () => {
ibusManager.activateProperty(item.prop.get_key(),
item.prop.get_state());
- }));
+ });
break;
case IBus.PropType.SEPARATOR:
this._permStoreProxy,
this._getMaxAccuracyLevel());
- authorizer.authorize(Lang.bind(this, function(accuracyLevel) {
+ authorizer.authorize(accuracyLevel => {
let ret = (accuracyLevel != GeoclueAccuracyLevel.NONE);
invocation.return_value(GLib.Variant.new('(bu)',
[ret, accuracyLevel]));
- }));
+ });
},
_syncIndicator() {
reason,
this.reqAccuracyLevel);
- let responseId = this._dialog.connect('response', Lang.bind(this,
- function(dialog, level) {
- this._dialog.disconnect(responseId);
- this._accuracyLevel = level;
- this._completeAuth();
- }));
+ let responseId = this._dialog.connect('response', (dialog, level) => {
+ this._dialog.disconnect(responseId);
+ this._accuracyLevel = level;
+ this._completeAuth();
+ });
this._dialog.open();
},
APP_PERMISSIONS_ID,
this._permissions,
data,
- function (result, error) {
+ (result, error) => {
if (error != null)
log(error.message);
});
if (!item)
return;
- item.connect('icon-changed', Lang.bind(this, function() {
- this._iconChanged();
- }));
- item.connect('activation-failed', Lang.bind(this, function(item, reason) {
+ item.connect('icon-changed', () => { this._iconChanged(); });
+ item.connect('activation-failed', (item, reason) => {
this.emit('activation-failed', reason);
- }));
+ });
item.connect('name-changed', Lang.bind(this, this._sync));
let pos = Util.insertSorted(this._connections, connection, Lang.bind(this, this._connectionSortFunction));
if (this._mobileDevice) {
this._operatorNameId = this._mobileDevice.connect('notify::operator-name', Lang.bind(this, this._sync));
- this._signalQualityId = this._mobileDevice.connect('notify::signal-quality', Lang.bind(this, function() {
+ this._signalQualityId = this._mobileDevice.connect('notify::signal-quality', () => {
this._iconChanged();
- }));
+ });
}
},
this.actor = new St.BoxLayout({ style_class: 'nm-dialog-item',
can_focus: true,
reactive: true });
- this.actor.connect('key-focus-in', Lang.bind(this, function() {
- this.emit('selected');
- }));
+ this.actor.connect('key-focus-in', () => { this.emit('selected'); });
let action = new Clutter.ClickAction();
- action.connect('clicked', Lang.bind(this, function() {
- this.actor.grab_key_focus();
- }));
+ action.connect('clicked', () => { this.actor.grab_key_focus(); });
this.actor.add_action(action);
let title = ssidToLabel(this._ap.get_ssid());
this._buildLayout();
let connections = client.get_connections();
- this._connections = connections.filter(Lang.bind(this, function(connection) {
- return device.connection_valid(connection);
- }));
+ this._connections = connections.filter(
+ connection => device.connection_valid(connection)
+ );
this._apAddedId = device.connect('access-point-added', Lang.bind(this, this._accessPointAdded));
this._apRemovedId = device.connect('access-point-removed', Lang.bind(this, this._accessPointRemoved));
// accessPointAdded will also create dialog items
let accessPoints = device.get_access_points() || [ ];
- accessPoints.forEach(Lang.bind(this, function(ap) {
+ accessPoints.forEach(ap => {
this._accessPointAdded(this._device, ap);
- }));
+ });
this._selectedNetwork = null;
this._activeApChanged();
let airplaneSubStack = new St.Widget({ layout_manager: new Clutter.BinLayout });
this._airplaneButton = new St.Button({ style_class: 'modal-dialog-button button' });
- this._airplaneButton.connect('clicked', Lang.bind(this, function() {
+ this._airplaneButton.connect('clicked', () => {
if (this._rfkill.airplaneMode)
this._rfkill.airplaneMode = false;
else
this._client.wireless_enabled = true;
- }));
+ });
airplaneSubStack.add_actor(this._airplaneButton);
this._airplaneInactive = new St.Label({ style_class: 'nm-dialog-airplane-text',
text: _("Use hardware switch to turn off") });
},
_checkConnections(network, accessPoint) {
- this._connections.forEach(function(connection) {
+ this._connections.forEach(connection => {
if (accessPoint.connection_valid(connection) &&
network.connections.indexOf(connection) == -1) {
network.connections.push(connection);
return;
}
- Util.insertSorted(network.accessPoints, accessPoint, function(one, two) {
+ Util.insertSorted(network.accessPoints, accessPoint, (one, two) => {
return two.strength - one.strength;
});
network.item.updateBestAP(network.accessPoints[0]);
let scrollValue = adjustment.value;
this._itemBox.remove_all_children();
- this._networks.forEach(Lang.bind(this, function(network) {
+ this._networks.forEach(network => {
this._itemBox.add_child(network.item.actor);
- }));
+ });
adjustment.value = scrollValue;
},
_createNetworkItem(network) {
network.item = new NMWirelessDialogItem(network);
network.item.setActive(network == this._selectedNetwork);
- network.item.connect('selected', Lang.bind(this, function() {
+ network.item.connect('selected', () => {
Util.ensureActorVisibleInScrollView(this._scrollView, network.item.actor);
this._selectNetwork(network);
- }));
+ });
},
});
for (let item of connections) {
item.setActiveConnection(null);
}
- vpnConnections.forEach(Lang.bind(this, function(a) {
+ vpnConnections.forEach(a => {
if (a.connection) {
let item = this._connectionItems.get(a.connection.get_uuid());
item.setActiveConnection(a);
}
- }));
+ });
},
_makeConnectionItem(connection) {
_sync() {
let nDevices = this.section.box.get_children().reduce(
- function(prev, child) {
- return prev + (child.visible ? 1 : 0);
- }, 0);
+ (prev, child) => prev + (child.visible ? 1 : 0), 0);
this._summaryItem.label.text = this._getSummaryLabel(nDevices);
let shouldSummarize = nDevices > MAX_DEVICE_ITEMS;
this._summaryItem.actor.visible = shouldSummarize;
'network-transmit-receive');
this._source.policy = new MessageTray.NotificationApplicationPolicy('gnome-network-panel');
- this._source.connect('destroy', Lang.bind(this, function() {
- this._source = null;
- }));
+ this._source.connect('destroy', () => { this._source = null; });
Main.messageTray.add(this._source);
}
},
this._notification = new MessageTray.Notification(this._source, title, text, { gicon: gicon });
this._notification.setUrgency(urgency);
this._notification.setTransient(true);
- this._notification.connect('destroy', function() {
+ this._notification.connect('destroy', () => {
this._notification = null;
});
this._source.notify(this._notification);
this._syncDeviceNames();
if (wrapper instanceof NMConnectionSection) {
- this._connections.forEach(function(connection) {
+ this._connections.forEach(connection => {
wrapper.checkConnection(connection);
});
}
_syncVpnConnections() {
let activeConnections = this._client.get_active_connections() || [];
- let vpnConnections = activeConnections.filter(function(a) {
- return (a instanceof NM.VpnConnection);
- });
- vpnConnections.forEach(Lang.bind(this, function(a) {
+ let vpnConnections = activeConnections.filter(
+ a => (a instanceof NM.VpnConnection)
+ );
+ vpnConnections.forEach(a => {
ensureActiveConnectionProps(a, this._client);
- }));
+ });
this._vpnSection.setActiveConnections(vpnConnections);
this._updateIcon();
this._vpnSection.checkConnection(connection);
} else {
let devices = this._devices[section].devices;
- devices.forEach(function(wrapper) {
+ devices.forEach(wrapper => {
if (wrapper instanceof NMConnectionSection)
wrapper.checkConnection(connection);
});
this._closeConnectivityCheck(path);
return;
} else if (result == PortalHelperResult.RECHECK) {
- this._client.check_connectivity_async(null, Lang.bind(this, function(client, result) {
+ this._client.check_connectivity_async(null, (client, result) => {
try {
let state = client.check_connectivity_finish(result);
if (state >= NM.ConnectivityState.FULL)
this._closeConnectivityCheck(path);
} catch(e) { }
- }));
+ });
} else {
log('Invalid result from portal helper: ' + result);
}
this._portalHelperProxy.AuthenticateRemote(path, '', timestamp);
} else {
new PortalHelperProxy(Gio.DBus.session, 'org.gnome.Shell.PortalHelper',
- '/org/gnome/Shell/PortalHelper', Lang.bind(this, function (proxy, error) {
+ '/org/gnome/Shell/PortalHelper', (proxy, error) => {
if (error) {
log('Error launching the portal helper: ' + error);
return;
proxy.connectSignal('Done', Lang.bind(this, this._portalHelperDone));
proxy.AuthenticateRemote(path, '', timestamp);
- }));
+ });
}
this._connectivityQueue.push(path);
this.indicators.add_style_class_name('power-status');
this._proxy = new PowerManagerProxy(Gio.DBus.system, BUS_NAME, OBJECT_PATH,
- Lang.bind(this, function(proxy, error) {
+ (proxy, error) => {
if (error) {
log(error.message);
return;
this._proxy.connect('g-properties-changed',
Lang.bind(this, this._sync));
this._sync();
- }));
+ });
this._item = new PopupMenu.PopupSubMenuMenuItem("", true);
this._item.menu.addSettingsAction(_("Power Settings"), 'gnome-power-panel.desktop');
_init() {
this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
- Lang.bind(this, function(proxy, error) {
+ (proxy, error) => {
if (error) {
log(error.message);
return;
this._proxy.connect('g-properties-changed',
Lang.bind(this, this._changed));
this._changed();
- }));
+ });
},
get airplaneMode() {
// changing the menu contents.
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Airplane Mode On"), true);
this._item.icon.icon_name = 'airplane-mode-symbolic';
- this._offItem = this._item.menu.addAction(_("Turn Off"), Lang.bind(this, function() {
+ this._offItem = this._item.menu.addAction(_("Turn Off"), () => {
this._manager.airplaneMode = false;
- }));
+ });
this._item.menu.addSettingsAction(_("Network Settings"), 'gnome-network-panel.desktop');
this.menu.addMenuItem(this._item);
// settings (disable-log-out) and Polkit policy - the latter doesn't
// notify, so we update the menu item each time the menu opens or
// the lockdown setting changes, which should be close enough.
- this.menu.connect('open-state-changed', Lang.bind(this,
- function(menu, open) {
- if (!open)
- return;
+ this.menu.connect('open-state-changed', (menu, open) => {
+ if (!open)
+ return;
- this._systemActions.forceUpdate();
- }));
+ this._systemActions.forceUpdate();
+ });
this._updateMultiUser();
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
// the popup menu, and we can't easily connect on allocation-changed
// or notify::width without creating layout cycles, simply update the
// label whenever the menu is opened.
- this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) {
+ this.menu.connect('open-state-changed', (menu, isOpen) => {
if (isOpen)
this._updateSwitchUserSubMenu();
- }));
+ });
item = new PopupMenu.PopupMenuItem(_("Switch User"));
item.connect('activate', () => {
enrollDevice(id, policy, callback) {
this._proxy.EnrollDeviceRemote(id, policy, AuthFlags.NONE,
- Lang.bind(this, function (res, error) {
+ (res, error) => {
if (error) {
callback(null, error);
return;
BOLT_DBUS_NAME,
path);
callback(device, null);
- }));
+ });
}
});
if (!this._source) {
this._source = new MessageTray.Source(_("Thunderbolt"),
'thunderbolt-symbolic');
- this._source.connect('destroy', Lang.bind(this, function() {
- this._source = null;
- }));
+ this._source.connect('destroy', () => { this._source = null; });
Main.messageTray.add(this._source);
}
this._notification = new MessageTray.Notification(source, title, body);
this._notification.setUrgency(MessageTray.Urgency.HIGH);
- this._notification.connect('destroy', function() {
+ this._notification.connect('destroy', () => {
this._notification = null;
});
this._notification.connect('activated', () => {
this._icon = new St.Icon({ style_class: 'popup-menu-icon' });
this.item.actor.add(this._icon);
this.item.actor.add(this._slider.actor, { expand: true });
- this.item.actor.connect('button-press-event', Lang.bind(this, function(actor, event) {
+ this.item.actor.connect('button-press-event', (actor, event) => {
return this._slider.startDragging(event);
- }));
- this.item.actor.connect('key-press-event', Lang.bind(this, function(actor, event) {
+ });
+ this.item.actor.connect('key-press-event', (actor, event) => {
return this._slider.onKeyPressEvent(actor, event);
- }));
+ });
this._stream = null;
},
this._control.connect('default-source-changed', Lang.bind(this, this._readInput));
this._output = new OutputStreamSlider(this._control);
- this._output.connect('stream-updated', Lang.bind(this, function() {
+ this._output.connect('stream-updated', () => {
this.emit('icon-changed');
- }));
+ });
this.addMenuItem(this._output.item);
this._input = new InputStreamSlider(this._control);
this._control = getMixerControl();
this._volumeMenu = new VolumeMenu(this._control);
- this._volumeMenu.connect('icon-changed', Lang.bind(this, function(menu) {
+ this._volumeMenu.connect('icon-changed', menu => {
let icon = this._volumeMenu.getIcon();
if (icon != null) {
} else {
this.indicators.hide();
}
- }));
+ });
this.menu.addMenuItem(this._volumeMenu);
// We delay showing the popup so that fast Alt+Tab users aren't
// disturbed by the popup briefly flashing.
this._initialDelayTimeoutId = Mainloop.timeout_add(POPUP_DELAY_TIMEOUT,
- Lang.bind(this, function () {
+ () => {
Main.osdWindowManager.hideAll();
this.actor.opacity = 255;
this._initialDelayTimeoutId = 0;
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(this._initialDelayTimeoutId, '[gnome-shell] Main.osdWindow.cancel');
return true;
},
Mainloop.source_remove(this._noModsTimeoutId);
this._noModsTimeoutId = Mainloop.timeout_add(NO_MODS_TIMEOUT,
- Lang.bind(this, function () {
+ () => {
this._finish(global.get_current_time());
this._noModsTimeoutId = 0;
return GLib.SOURCE_REMOVE;
- }));
+ });
},
_popModal() {
{ opacity: 0,
time: POPUP_FADE_OUT_TIME,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this,
- function() {
- this.actor.destroy();
- })
+ onComplete: () => {
+ this.actor.destroy();
+ }
});
} else
this.actor.destroy();
// children to have the same width.
this._list = new Shell.GenericContainer({ style_class: 'switcher-list-item-container' });
this._list.spacing = 0;
- this._list.connect('style-changed', Lang.bind(this, function() {
- this._list.spacing = this._list.get_theme_node().get_length('spacing');
- }));
+ this._list.connect('style-changed', () => {
+ this._list.spacing = this._list.get_theme_node().get_length('spacing');
+ });
this._list.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
this._list.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
// Those arrows indicate whether scrolling in one direction is possible
this._leftArrow = new St.DrawingArea({ style_class: 'switcher-arrow',
pseudo_class: 'highlighted' });
- this._leftArrow.connect('repaint', Lang.bind(this,
- function() { drawArrow(this._leftArrow, St.Side.LEFT); }));
+ this._leftArrow.connect('repaint', () => {
+ drawArrow(this._leftArrow, St.Side.LEFT);
+ });
this._rightArrow = new St.DrawingArea({ style_class: 'switcher-arrow',
pseudo_class: 'highlighted' });
- this._rightArrow.connect('repaint', Lang.bind(this,
- function() { drawArrow(this._rightArrow, St.Side.RIGHT); }));
+ this._rightArrow.connect('repaint', () => {
+ drawArrow(this._rightArrow, St.Side.RIGHT);
+ });
this.actor.add_actor(this._leftArrow);
this.actor.add_actor(this._rightArrow);
this._list.add_actor(bbox);
let n = this._items.length;
- bbox.connect('clicked', Lang.bind(this, function() { this._onItemClicked(n); }));
- bbox.connect('motion-event', Lang.bind(this, function() { return this._onItemEnter(n); }));
+ bbox.connect('clicked', () => { this._onItemClicked(n); });
+ bbox.connect('motion-event', () => this._onItemEnter(n));
bbox.label_actor = label;
{ value: value,
time: POPUP_SCROLL_TIME,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this, function () {
+ onComplete: () => {
if (this._highlighted == 0)
this._scrollableLeft = false;
this.actor.queue_relayout();
- })
+ }
});
},
{ value: value,
time: POPUP_SCROLL_TIME,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this, function () {
+ onComplete: () => {
if (this._highlighted == this._items.length - 1)
this._scrollableRight = false;
this.actor.queue_relayout();
- })
+ }
});
},
state.destroyedId = target.connect('destroy', _actorDestroyed);
} else if (target.actor && target.actor instanceof Clutter.Actor) {
state.actor = target.actor;
- state.destroyedId = target.actor.connect('destroy', function() { _actorDestroyed(target); });
+ state.destroyedId = target.actor.connect('destroy', () => { _actorDestroyed(target); });
}
}
let oldParams = params[name + 'Params'];
let eventScope = oldScope ? oldScope : target;
- params[name] = function () {
+ params[name] = () => {
oldHandler.apply(eventScope, oldParams);
handler(target);
};
} else
- params[name] = function () { handler(target); };
+ params[name] = () => { handler(target); };
}
function _actorDestroyed(target) {
this._startTime = -1;
this._currentTime = -1;
- this._timeline.connect('new-frame', Lang.bind(this,
- function(timeline, frame) {
- this._onNewFrame(frame);
- }));
+ this._timeline.connect('new-frame', (timeline, frame) => {
+ this._onNewFrame(frame);
+ });
let perf_log = Shell.PerfLog.get_default();
perf_log.define_event("tweener.framePrepareStart",
this.parent();
this.set_n_touch_points(3);
- global.display.connect('grab-op-begin', Lang.bind(this, function() {
+ global.display.connect('grab-op-begin', () => {
this.cancel();
- }));
+ });
},
vfunc_gesture_prepare(action, actor) {
this._text = this._entry.clutter_text;
this._text.connect('text-changed', Lang.bind(this, this._onTextChanged));
this._text.connect('key-press-event', Lang.bind(this, this._onKeyPress));
- this._text.connect('key-focus-in', Lang.bind(this, function() {
+ this._text.connect('key-focus-in', () => {
this._searchResults.highlightDefault(true);
- }));
- this._text.connect('key-focus-out', Lang.bind(this, function() {
+ });
+ this._text.connect('key-focus-out', () => {
this._searchResults.highlightDefault(false);
- }));
+ });
this._entry.connect('popup-menu', () => {
if (!this._searchActive)
return;
// dummy widget as the last results container child so that we can
// include the entry in the keynav tab path
this._focusTrap = new FocusTrap({ can_focus: true });
- this._focusTrap.connect('key-focus-in', Lang.bind(this, function() {
+ this._focusTrap.connect('key-focus-in', () => {
this._entry.grab_key_focus();
- }));
+ });
this._searchResults.actor.add_actor(this._focusTrap);
global.focus_manager.add_group(this._searchResults.actor);
this._stageKeyPressId = 0;
- Main.overview.connect('showing', Lang.bind(this,
- function () {
- this._stageKeyPressId = global.stage.connect('key-press-event',
- Lang.bind(this, this._onStageKeyPress));
- }));
- Main.overview.connect('hiding', Lang.bind(this,
- function () {
- if (this._stageKeyPressId != 0) {
- global.stage.disconnect(this._stageKeyPressId);
- this._stageKeyPressId = 0;
- }
- }));
- Main.overview.connect('shown', Lang.bind(this,
- function() {
- // If we were animating from the desktop view to the
- // apps page the workspace page was visible, allowing
- // the windows to animate, but now we no longer want to
- // show it given that we are now on the apps page or
- // search page.
- if (this._activePage != this._workspacesPage) {
- this._workspacesPage.opacity = 0;
- this._workspacesPage.hide();
- }
- }));
+ Main.overview.connect('showing', () => {
+ this._stageKeyPressId = global.stage.connect('key-press-event',
+ Lang.bind(this, this._onStageKeyPress));
+ });
+ Main.overview.connect('hiding', () => {
+ if (this._stageKeyPressId != 0) {
+ global.stage.disconnect(this._stageKeyPressId);
+ this._stageKeyPressId = 0;
+ }
+ });
+ Main.overview.connect('shown', () => {
+ // If we were animating from the desktop view to the
+ // apps page the workspace page was visible, allowing
+ // the windows to animate, but now we no longer want to
+ // show it given that we are now on the apps page or
+ // search page.
+ if (this._activePage != this._workspacesPage) {
+ this._workspacesPage.opacity = 0;
+ this._workspacesPage.hide();
+ }
+ });
Main.wm.addKeybinding('toggle-application-view',
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
side = St.Side.LEFT;
let gesture = new EdgeDragAction.EdgeDragAction(side,
Shell.ActionMode.NORMAL);
- gesture.connect('activated', Lang.bind(this, function() {
+ gesture.connect('activated', () => {
if (Main.overview.visible)
Main.overview.hide();
else
this.showApps();
- }));
+ });
global.stage.add_action(gesture);
gesture = new ShowOverviewAction();
else
Main.ctrlAltTabManager.addGroup(actor, name, a11yIcon,
{ proxy: this.actor,
- focusCallback: Lang.bind(this,
- function() {
- this._a11yFocusPage(page);
- })
+ focusCallback: () => {
+ this._a11yFocusPage(page);
+ }
});;
page.hide();
this.actor.add_actor(page);
{ opacity: 0,
time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this, function() {
+ onComplete: () => {
this._animateIn(oldPage);
- })
+ }
});
},
if (page == this._appsPage &&
this._activePage == this._workspacesPage &&
!Main.overview.animationInProgress) {
- this.appDisplay.animate(IconGrid.AnimationDirection.OUT, Lang.bind(this,
- function() {
- this._animateIn(oldPage)
- }));
+ this.appDisplay.animate(IconGrid.AnimationDirection.OUT, () => {
+ this._animateIn(oldPage)
+ });
} else {
this._fadePageOut(page);
}
let [title, banner] = this._getTitleAndBanner(app, window);
let notification = new MessageTray.Notification(source, title, banner);
- notification.connect('activated', function() {
+ notification.connect('activated', () => {
source.open();
});
notification.setForFeedback(true);
source.notify(notification);
- source.signalIDs.push(window.connect('notify::title', Lang.bind(this, function() {
+ source.signalIDs.push(window.connect('notify::title', () => {
let [title, banner] = this._getTitleAndBanner(app, window);
notification.update(title, banner);
- })));
+ }));
}
});
this.parent(app.get_name());
this.signalIDs = [];
- this.signalIDs.push(this._window.connect('notify::demands-attention', Lang.bind(this, function() { this.destroy(); })));
- this.signalIDs.push(this._window.connect('focus', Lang.bind(this, function() { this.destroy(); })));
- this.signalIDs.push(this._window.connect('unmanaged', Lang.bind(this, function() { this.destroy(); })));
+ this.signalIDs.push(this._window.connect('notify::demands-attention',
+ () => { this.destroy(); }));
+ this.signalIDs.push(this._window.connect('focus',
+ () => { this.destroy(); }));
+ this.signalIDs.push(this._window.connect('unmanaged',
+ () => { this.destroy(); }));
this.connect('destroy', Lang.bind(this, this._onDestroy));
},
if (workspace._keepAliveId)
Mainloop.source_remove(workspace._keepAliveId);
- workspace._keepAliveId = Mainloop.timeout_add(duration, Lang.bind(this, function() {
+ workspace._keepAliveId = Mainloop.timeout_add(duration, () => {
workspace._keepAliveId = 0;
this._queueCheckWorkspaces();
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(workspace._keepAliveId, '[gnome-shell] this._queueCheckWorkspaces');
},
_windowRemoved(workspace, window) {
workspace._lastRemovedWindow = window;
this._queueCheckWorkspaces();
- let id = Mainloop.timeout_add(LAST_WINDOW_GRACE_TIME, Lang.bind(this, function() {
+ let id = Mainloop.timeout_add(LAST_WINDOW_GRACE_TIME, () => {
if (workspace._lastRemovedWindow == window) {
workspace._lastRemovedWindow = null;
this._queueCheckWorkspaces();
}
return GLib.SOURCE_REMOVE;
- }));
+ });
GLib.Source.set_name_by_id(id, '[gnome-shell] this._queueCheckWorkspaces');
},
}
let lostWorkspaces = this._workspaces.splice(removedIndex, removedNum);
- lostWorkspaces.forEach(function(workspace) {
+ lostWorkspaces.forEach(workspace => {
workspace.disconnect(workspace._windowAddedId);
workspace.disconnect(workspace._windowRemovedId);
});
this.set_n_touch_points(4);
this.set_threshold_trigger_distance(MOTION_THRESHOLD, MOTION_THRESHOLD);
- global.display.connect('grab-op-begin', Lang.bind(this, function() {
+ global.display.connect('grab-op-begin', () => {
this.cancel();
- }));
+ });
},
vfunc_gesture_prepare(actor) {
this.parent();
this.set_n_touch_points(3);
- global.display.connect('grab-op-begin', Lang.bind(this, function() {
+ global.display.connect('grab-op-begin', () => {
this.cancel();
- }));
+ });
},
vfunc_gesture_prepare(action, actor) {
this._switchData = null;
this._shellwm.connect('kill-switch-workspace', Lang.bind(this, this._switchWorkspaceDone));
- this._shellwm.connect('kill-window-effects', Lang.bind(this, function (shellwm, actor) {
+ this._shellwm.connect('kill-window-effects', (shellwm, actor) => {
this._minimizeWindowDone(shellwm, actor);
this._mapWindowDone(shellwm, actor);
this._destroyWindowDone(shellwm, actor);
this._sizeChangeWindowDone(shellwm, actor);
- }));
+ });
this._shellwm.connect('switch-workspace', Lang.bind(this, this._switchWorkspace));
this._shellwm.connect('show-tile-preview', Lang.bind(this, this._showTilePreview));
global.display.connect('show-resize-popup', Lang.bind(this, this._showResizePopup));
global.display.connect('show-pad-osd', Lang.bind(this, this._showPadOsd));
- global.display.connect('show-osd', Lang.bind(this, function (display, monitorIndex, iconName, label) {
+ global.display.connect('show-osd', (display, monitorIndex, iconName, label) => {
let icon = Gio.Icon.new_for_string(iconName);
Main.osdWindowManager.show(monitorIndex, icon, label, null);
- }));
+ });
this._gsdWacomProxy = new GsdWacomProxy(Gio.DBus.session, GSD_WACOM_BUS_NAME,
GSD_WACOM_OBJECT_PATH,
- Lang.bind(this, function(proxy, error) {
+ (proxy, error) => {
if (error) {
log(error.message);
return;
}
- }));
+ });
- global.display.connect('pad-mode-switch', Lang.bind(this, function (display, pad, group, mode) {
+ global.display.connect('pad-mode-switch', (display, pad, group, mode) => {
let labels = [];
//FIXME: Fix num buttons
this._gsdWacomProxy.SetOLEDLabelsRemote(pad.get_device_node(), labels);
this._gsdWacomProxy.SetGroupModeLEDRemote(pad.get_device_node(), group, mode);
}
- }));
+ });
- Main.overview.connect('showing', Lang.bind(this, function() {
+ Main.overview.connect('showing', () => {
for (let i = 0; i < this._dimmedWindows.length; i++)
this._undimWindow(this._dimmedWindows[i]);
- }));
- Main.overview.connect('hiding', Lang.bind(this, function() {
+ });
+ Main.overview.connect('hiding', () => {
for (let i = 0; i < this._dimmedWindows.length; i++)
this._dimWindow(this._dimmedWindows[i]);
- }));
+ });
this._windowMenuManager = new WindowMenu.WindowMenuManager();
let mode = Shell.ActionMode.ALL & ~Shell.ActionMode.LOCK_SCREEN;
gesture = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM, mode);
- gesture.connect('activated', Lang.bind(this, function() {
+ gesture.connect('activated', () => {
Main.keyboard.show(Main.layoutManager.bottomIndex);
- }));
+ });
global.stage.add_action(gesture);
},
_showPadOsd(display, device, settings, imagePath, editionMode, monitorIndex) {
this._currentPadOsd = new PadOsd.PadOsd(device, settings, imagePath, editionMode, monitorIndex);
- this._currentPadOsd.connect('closed', Lang.bind(this, function() { this._currentPadOsd = null }));
+ this._currentPadOsd.connect('closed', () => { this._currentPadOsd = null });
return this._currentPadOsd.actor;
},
},
_switchApp() {
- let windows = global.get_window_actors().filter(Lang.bind(this, function(actor) {
+ let windows = global.get_window_actors().filter(actor => {
let win = actor.metaWindow;
return (!win.is_override_redirect() &&
win.located_on_workspace(global.screen.get_active_workspace()));
- }));
+ });
if (windows.length == 0)
return;
global.screen.append_new_workspace(false, global.get_current_time());
- let windows = global.get_window_actors().map(function(winActor) {
- return winActor.meta_window;
- });
+ let windows = global.get_window_actors().map(a => a.meta_window);
// To create a new workspace, we slide all the windows on workspaces
// below us to the next workspace, leaving a blank workspace for us
// to recycle.
- windows.forEach(function(window) {
+ windows.forEach(window => {
// If the window is attached to an ancestor, we don't need/want
// to move it
if (window.get_transient_for() != null)
_hasAttachedDialogs(window, ignoreWindow) {
var count = 0;
- window.foreach_transient(function(win) {
+ window.foreach_transient(win => {
if (win != ignoreWindow &&
win.is_attached_dialog() &&
win.get_transient_for() == window) {
this._dimWindow(window);
} else if (!shouldDim && window._dimmed) {
window._dimmed = false;
- this._dimmedWindows = this._dimmedWindows.filter(function(win) {
- return win != window;
- });
+ this._dimmedWindows =
+ this._dimmedWindows.filter(win => win != window);
this._undimWindow(window);
}
},
_mapWindow(shellwm, actor) {
actor._windowType = actor.meta_window.get_window_type();
- actor._notifyWindowTypeSignalId = actor.meta_window.connect('notify::window-type', Lang.bind(this, function () {
- let type = actor.meta_window.get_window_type();
- if (type == actor._windowType)
- return;
- if (type == Meta.WindowType.MODAL_DIALOG ||
- actor._windowType == Meta.WindowType.MODAL_DIALOG) {
- let parent = actor.get_meta_window().get_transient_for();
- if (parent)
- this._checkDimming(parent);
- }
+ actor._notifyWindowTypeSignalId =
+ actor.meta_window.connect('notify::window-type', () => {
+ let type = actor.meta_window.get_window_type();
+ if (type == actor._windowType)
+ return;
+ if (type == Meta.WindowType.MODAL_DIALOG ||
+ actor._windowType == Meta.WindowType.MODAL_DIALOG) {
+ let parent = actor.get_meta_window().get_transient_for();
+ if (parent)
+ this._checkDimming(parent);
+ }
- actor._windowType = type;
- }));
- actor.meta_window.connect('unmanaged', Lang.bind(this, function(window) {
- let parent = window.get_transient_for();
- if (parent)
- this._checkDimming(parent);
- }));
+ actor._windowType = type;
+ });
+ actor.meta_window.connect('unmanaged', window => {
+ let parent = window.get_transient_for();
+ if (parent)
+ this._checkDimming(parent);
+ });
if (actor.meta_window.is_attached_dialog())
this._checkDimming(actor.get_meta_window().get_transient_for());
actor._notifyWindowTypeSignalId = 0;
}
if (window._dimmed) {
- this._dimmedWindows = this._dimmedWindows.filter(function(win) {
- return win != window;
- });
+ this._dimmedWindows =
+ this._dimmedWindows.filter(win => win != window);
}
if (window.is_attached_dialog())
if (window.is_attached_dialog()) {
let parent = window.get_transient_for();
- actor._parentDestroyId = parent.connect('unmanaged', Lang.bind(this, function () {
+ actor._parentDestroyId = parent.connect('unmanaged', () => {
Tweener.removeTweens(actor);
this._destroyWindowDone(shellwm, actor);
- }));
+ });
}
Tweener.addTween(actor,
if (this._workspaceSwitcherPopup == null) {
this._workspaceTracker.blockUpdates();
this._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup();
- this._workspaceSwitcherPopup.connect('destroy', Lang.bind(this, function() {
+ this._workspaceSwitcherPopup.connect('destroy', () => {
this._workspaceTracker.unblockUpdates();
this._workspaceSwitcherPopup = null;
this._isWorkspacePrepended = false;
- }));
+ });
}
this._workspaceSwitcherPopup.display(direction, newWs.index());
}
let item;
- item = this.addAction(_("Minimize"), Lang.bind(this, function(event) {
+ item = this.addAction(_("Minimize"), () => {
window.minimize();
- }));
+ });
if (!window.can_minimize())
item.setSensitive(false);
if (window.get_maximized()) {
- item = this.addAction(_("Unmaximize"), Lang.bind(this, function() {
+ item = this.addAction(_("Unmaximize"), () => {
window.unmaximize(Meta.MaximizeFlags.BOTH);
- }));
+ });
} else {
- item = this.addAction(_("Maximize"), Lang.bind(this, function() {
+ item = this.addAction(_("Maximize"), () => {
window.maximize(Meta.MaximizeFlags.BOTH);
- }));
+ });
}
if (!window.can_maximize())
item.setSensitive(false);
- item = this.addAction(_("Move"), Lang.bind(this, function(event) {
+ item = this.addAction(_("Move"), event => {
window.begin_grab_op(Meta.GrabOp.KEYBOARD_MOVING, true, event.get_time());
- }));
+ });
if (!window.allows_move())
item.setSensitive(false);
- item = this.addAction(_("Resize"), Lang.bind(this, function(event) {
+ item = this.addAction(_("Resize"), event => {
window.begin_grab_op(Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN, true, event.get_time());
- }));
+ });
if (!window.allows_resize())
item.setSensitive(false);
if (!window.titlebar_is_onscreen() && type != Meta.WindowType.DOCK && type != Meta.WindowType.DESKTOP) {
- this.addAction(_("Move Titlebar Onscreen"), Lang.bind(this, function(event) {
+ this.addAction(_("Move Titlebar Onscreen"), () => {
window.shove_titlebar_onscreen();
- }));
+ });
}
- item = this.addAction(_("Always on Top"), Lang.bind(this, function() {
+ item = this.addAction(_("Always on Top"), () => {
if (window.is_above())
window.unmake_above();
else
window.make_above();
- }));
+ });
if (window.is_above())
item.setOrnament(PopupMenu.Ornament.CHECK);
if (window.get_maximized() == Meta.MaximizeFlags.BOTH ||
window.is_on_primary_monitor())) {
let isSticky = window.is_on_all_workspaces();
- item = this.addAction(_("Always on Visible Workspace"), Lang.bind(this, function() {
+ item = this.addAction(_("Always on Visible Workspace"), () => {
if (isSticky)
window.unstick();
else
window.stick();
- }));
+ });
if (isSticky)
item.setOrnament(PopupMenu.Ornament.CHECK);
if (window.is_always_on_all_workspaces())
if (!isSticky) {
let workspace = window.get_workspace();
if (workspace != workspace.get_neighbor(Meta.MotionDirection.LEFT)) {
- this.addAction(_("Move to Workspace Left"), Lang.bind(this, function(event) {
- window.change_workspace(workspace.get_neighbor(Meta.MotionDirection.LEFT));
- }));
+ this.addAction(_("Move to Workspace Left"), () => {
+ let dir = Meta.MotionDirection.LEFT;
+ window.change_workspace(workspace.get_neighbor(dir));
+ });
}
if (workspace != workspace.get_neighbor(Meta.MotionDirection.RIGHT)) {
- this.addAction(_("Move to Workspace Right"), Lang.bind(this, function(event) {
- window.change_workspace(workspace.get_neighbor(Meta.MotionDirection.RIGHT));
- }));
+ this.addAction(_("Move to Workspace Right"), () => {
+ let dir = Meta.MotionDirection.RIGHT;
+ window.change_workspace(workspace.get_neighbor(dir));
+ });
}
if (workspace != workspace.get_neighbor(Meta.MotionDirection.UP)) {
- this.addAction(_("Move to Workspace Up"), Lang.bind(this, function(event) {
- window.change_workspace(workspace.get_neighbor(Meta.MotionDirection.UP));
- }));
+ this.addAction(_("Move to Workspace Up"), () => {
+ let dir = Meta.MotionDirection.UP;
+ window.change_workspace(workspace.get_neighbor(dir));
+ });
}
if (workspace != workspace.get_neighbor(Meta.MotionDirection.DOWN)) {
- this.addAction(_("Move to Workspace Down"), Lang.bind(this, function(event) {
- window.change_workspace(workspace.get_neighbor(Meta.MotionDirection.DOWN));
- }));
+ this.addAction(_("Move to Workspace Down"), () => {
+ let dir = Meta.MotionDirection.DOWN;
+ window.change_workspace(workspace.get_neighbor(dir));
+ });
}
}
}
let screen = global.screen;
let nMonitors = screen.get_n_monitors();
if (nMonitors > 1) {
- this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
-
- let monitorIndex = window.get_monitor();
-
- let upMonitorIndex = screen.get_monitor_neighbor_index(monitorIndex, Meta.ScreenDirection.UP);
- if (upMonitorIndex != -1) {
- this.addAction(_("Move to Monitor Up"), Lang.bind(this, function(event) {
- window.move_to_monitor(upMonitorIndex);
- }));
- }
- let downMonitorIndex = screen.get_monitor_neighbor_index(monitorIndex, Meta.ScreenDirection.DOWN);
- if (downMonitorIndex != -1) {
- this.addAction(_("Move to Monitor Down"), Lang.bind(this, function(event) {
- window.move_to_monitor(downMonitorIndex);
- }));
- }
- let leftMonitorIndex = screen.get_monitor_neighbor_index(monitorIndex, Meta.ScreenDirection.LEFT);
- if (leftMonitorIndex != -1) {
- this.addAction(_("Move to Monitor Left"), Lang.bind(this, function(event) {
- window.move_to_monitor(leftMonitorIndex);
- }));
- }
- let rightMonitorIndex = screen.get_monitor_neighbor_index(monitorIndex, Meta.ScreenDirection.RIGHT);
- if (rightMonitorIndex != -1) {
- this.addAction(_("Move to Monitor Right"), Lang.bind(this, function(event) {
- window.move_to_monitor(rightMonitorIndex);
- }));
- }
+ this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
+
+ let monitorIndex = window.get_monitor();
+
+ let dir = Meta.ScreenDirection.UP;
+ let upMonitorIndex =
+ screen.get_monitor_neighbor_index(monitorIndex, dir);
+ if (upMonitorIndex != -1) {
+ this.addAction(_("Move to Monitor Up"), () => {
+ window.move_to_monitor(upMonitorIndex);
+ });
+ }
+
+ dir = Meta.ScreenDirection.DOWN;
+ let downMonitorIndex =
+ screen.get_monitor_neighbor_index(monitorIndex, dir);
+ if (downMonitorIndex != -1) {
+ this.addAction(_("Move to Monitor Down"), () => {
+ window.move_to_monitor(downMonitorIndex);
+ });
+ }
+
+ dir = Meta.ScreenDirection.LEFT;
+ let leftMonitorIndex =
+ screen.get_monitor_neighbor_index(monitorIndex, dir);
+ if (leftMonitorIndex != -1) {
+ this.addAction(_("Move to Monitor Left"), () => {
+ window.move_to_monitor(leftMonitorIndex);
+ });
+ }
+
+ dir = Meta.ScreenDirection.RIGHT;
+ let rightMonitorIndex =
+ screen.get_monitor_neighbor_index(monitorIndex, dir);
+ if (rightMonitorIndex != -1) {
+ this.addAction(_("Move to Monitor Right"), () => {
+ window.move_to_monitor(rightMonitorIndex);
+ });
+ }
}
this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
- item = this.addAction(_("Close"), Lang.bind(this, function(event) {
+ item = this.addAction(_("Close"), event => {
window.delete(event.get_time());
- }));
+ });
if (!window.can_close())
item.setSensitive(false);
}
this._manager = new PopupMenu.PopupMenuManager({ actor: Main.layoutManager.dummyCursor });
this._sourceActor = new St.Widget({ reactive: true, visible: false });
- this._sourceActor.connect('button-press-event', Lang.bind(this,
- function() {
- this._manager.activeMenu.toggle();
- }));
+ this._sourceActor.connect('button-press-event', () => {
+ this._manager.activeMenu.toggle();
+ });
Main.uiGroup.add_actor(this._sourceActor);
},
this._manager.addMenu(menu);
- menu.connect('activate', function() {
+ menu.connect('activate', () => {
window.check_alive(global.get_current_time());
});
- let destroyId = window.connect('unmanaged',
- function() {
- menu.close();
- });
+ let destroyId = window.connect('unmanaged', () => {
+ menu.close();
+ });
this._sourceActor.set_size(Math.max(1, rect.width), Math.max(1, rect.height));
this._sourceActor.set_position(rect.x, rect.y);
menu.open(BoxPointer.PopupAnimation.NONE);
menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
- menu.connect('open-state-changed', Lang.bind(this, function(menu_, isOpen) {
+ menu.connect('open-state-changed', (menu_, isOpen) => {
if (isOpen)
return;
this._sourceActor.hide();
menu.destroy();
window.disconnect(destroyId);
- }));
+ });
}
});
},
vfunc_allocate(container, box, flags) {
- container.get_children().forEach(Lang.bind(this, function (child) {
+ container.get_children().forEach(child => {
let realWindow;
if (child == container._delegate._windowClone)
realWindow = container._delegate.realWindow;
child.allocate(this._makeBoxForWindow(realWindow.meta_window),
flags);
- }));
+ });
}
});
this._windowClone._updateId = this.metaWindow.connect('size-changed',
Lang.bind(this, this._onRealWindowSizeChanged));
- this._windowClone._destroyId = this.realWindow.connect('destroy', Lang.bind(this, function() {
- // First destroy the clone and then destroy everything
- // This will ensure that we never see it in the _disconnectSignals loop
- this._windowClone.destroy();
- this.destroy();
- }));
+ this._windowClone._destroyId =
+ this.realWindow.connect('destroy', () => {
+ // First destroy the clone and then destroy everything
+ // This will ensure that we never see it in the
+ // _disconnectSignals loop
+ this._windowClone.destroy();
+ this.destroy();
+ });
this._updateAttachedDialogs();
this._computeBoundingBox();
_doAddAttachedDialog(metaWin, realWin) {
let clone = new Clutter.Clone({ source: realWin });
- clone._updateId = metaWin.connect('size-changed', Lang.bind(this, function() {
+ clone._updateId = metaWin.connect('size-changed', () => {
this._computeBoundingBox();
this.emit('size-changed');
- }));
- clone._destroyId = realWin.connect('destroy', Lang.bind(this, function() {
+ });
+ clone._destroyId = realWin.connect('destroy', () => {
clone.destroy();
this._computeBoundingBox();
this.emit('size-changed');
- }));
+ });
this.actor.add_child(clone);
},
_updateAttachedDialogs() {
- let iter = Lang.bind(this, function(win) {
+ let iter = win => {
let actor = win.get_compositor_private();
if (!actor)
this._doAddAttachedDialog(win, actor);
win.foreach_transient(iter);
return true;
- });
+ };
this.metaWindow.foreach_transient(iter);
},
_computeBoundingBox() {
let rect = this.metaWindow.get_frame_rect();
- this.actor.get_children().forEach(function (child) {
+ this.actor.get_children().forEach(child => {
let realWindow;
if (child == this._windowClone)
realWindow = this.realWindow;
let metaWindow = realWindow.meta_window;
rect = rect.union(metaWindow.get_frame_rect());
- }, this);
+ });
// Convert from a MetaRectangle to a native JS object
this._boundingBox = { x: rect.x, y: rect.y, width: rect.width, height: rect.height };
},
_disconnectSignals() {
- this.actor.get_children().forEach(Lang.bind(this, function (child) {
+ this.actor.get_children().forEach(child => {
let realWindow;
if (child == this._windowClone)
realWindow = this.realWindow;
realWindow.meta_window.disconnect(child._updateId);
realWindow.disconnect(child._destroyId);
- }));
+ });
},
_onRealWindowSizeChanged() {
// A click cancels a long-press before any click handler is
// run - make sure to not start a drag in that case
- Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
- function() {
- if (this._selected)
- return;
- let [x, y] = action.get_coords();
- action.release();
- this._draggable.startDrag(x, y, global.get_current_time(), this._dragTouchSequence);
- }));
+ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
+ if (this._selected)
+ return;
+ let [x, y] = action.get_coords();
+ action.release();
+ this._draggable.startDrag(x, y, global.get_current_time(), this._dragTouchSequence);
+ });
} else {
this.emit('show-chrome');
}
title.clutter_text.ellipsize = Pango.EllipsizeMode.END;
windowClone.actor.label_actor = title;
- this._updateCaptionId = metaWindow.connect('notify::title',
- Lang.bind(this, function(w) {
- this.title.text = w.title;
- this.relayout(false);
- }));
+ this._updateCaptionId = metaWindow.connect('notify::title', w => {
+ this.title.text = w.title;
+ this.relayout(false);
+ });
let button = new St.Button({ style_class: 'window-close' });
button._overlap = 0;
// use an idle handler to avoid mapping problems -
// see comment in Workspace._windowAdded
- let id = Mainloop.idle_add(Lang.bind(this,
- function() {
- this._windowClone.emit('selected');
- return GLib.SOURCE_REMOVE;
- }));
+ let id = Mainloop.idle_add(() => {
+ this._windowClone.emit('selected');
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(id, '[gnome-shell] this._windowClone.emit');
}
},
_sortRow(row) {
// Sort windows horizontally to minimize travel distance
- row.windows.sort(function(a, b) {
- return a.realWindow.x - b.realWindow.x;
- });
+ row.windows.sort((a, b) => a.realWindow.x - b.realWindow.x);
},
computeLayout(windows, layout) {
this._positionWindowsFlags = 0;
this._positionWindowsId = 0;
- this.actor.connect('notify::mapped', Lang.bind(this, function() {
+ this.actor.connect('notify::mapped', () => {
if (this.actor.mapped)
this._syncActualGeometry();
- }));
+ });
},
setFullGeometry(geom) {
if (!this._actualGeometry)
return;
- this._actualGeometryLater = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
+ this._actualGeometryLater = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._actualGeometryLater = 0;
if (!this.actor.mapped)
return false;
this._updateWindowPositions(Main.overview.animationInProgress ? WindowPositionFlags.ANIMATE : WindowPositionFlags.NONE);
return false;
- }));
+ });
},
_lookupIndex(metaWindow) {
if (this._positionWindowsId > 0)
return;
- this._positionWindowsId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
+ this._positionWindowsId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._realRecalculateWindowPositions(this._positionWindowsFlags);
this._positionWindowsFlags = 0;
this._positionWindowsId = 0;
return false;
- }));
+ });
},
_realRecalculateWindowPositions(flags) {
if (clones.length == 0)
return;
- clones.sort(function(a, b) {
+ clones.sort((a, b) => {
return a.metaWindow.get_stable_sequence() - b.metaWindow.get_stable_sequence();
});
syncStacking(stackIndices) {
let clones = this._windows.slice();
- clones.sort(function (a, b) { return stackIndices[a.metaWindow.get_stable_sequence()] - stackIndices[b.metaWindow.get_stable_sequence()]; });
+ clones.sort((a, b) => {
+ let indexA = stackIndices[a.metaWindow.get_stable_sequence()];
+ let indexB = stackIndices[b.metaWindow.get_stable_sequence()];
+ return indexA - indexB;
+ });
for (let i = 0; i < clones.length; i++) {
let clone = clones[i];
scale_y: scale,
time: Overview.ANIMATION_TIME,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this, function() {
+ onComplete: () => {
this._showWindowOverlay(clone, overlay);
- })
+ }
});
clone.overlay.relayout(true);
if (!win) {
// Newly-created windows are added to a workspace before
// the compositor finds out about them...
- let id = Mainloop.idle_add(Lang.bind(this,
- function () {
- if (this.actor &&
- metaWin.get_compositor_private() &&
- metaWin.get_workspace() == this.metaWorkspace)
- this._doAddWindow(metaWin);
- return GLib.SOURCE_REMOVE;
- }));
+ let id = Mainloop.idle_add(() => {
+ if (this.actor &&
+ metaWin.get_compositor_private() &&
+ metaWin.get_workspace() == this.metaWorkspace)
+ this._doAddWindow(metaWin);
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(id, '[gnome-shell] this._doAddWindow');
return;
}
clone.connect('selected',
Lang.bind(this, this._onCloneSelected));
- clone.connect('drag-begin',
- Lang.bind(this, function() {
- Main.overview.beginWindowDrag(clone.metaWindow);
- overlay.hide();
- }));
- clone.connect('drag-cancelled',
- Lang.bind(this, function() {
- Main.overview.cancelledWindowDrag(clone.metaWindow);
- }));
- clone.connect('drag-end',
- Lang.bind(this, function() {
- Main.overview.endWindowDrag(clone.metaWindow);
- overlay.show();
- }));
- clone.connect('size-changed',
- Lang.bind(this, function() {
- this._recalculateWindowPositions(WindowPositionFlags.NONE);
- }));
+ clone.connect('drag-begin', () => {
+ Main.overview.beginWindowDrag(clone.metaWindow);
+ overlay.hide();
+ });
+ clone.connect('drag-cancelled', () => {
+ Main.overview.cancelledWindowDrag(clone.metaWindow);
+ });
+ clone.connect('drag-end', () => {
+ Main.overview.endWindowDrag(clone.metaWindow);
+ overlay.show();
+ });
+ clone.connect('size-changed', () => {
+ this._recalculateWindowPositions(WindowPositionFlags.NONE);
+ });
this.actor.add_actor(clone.actor);
this._childHeight = 0;
this._childWidth = 0;
this._timeoutId = 0;
- this._list.connect('style-changed', Lang.bind(this, function() {
- this._itemSpacing = this._list.get_theme_node().get_length('spacing');
- }));
+ this._list.connect('style-changed', () => {
+ this._itemSpacing = this._list.get_theme_node().get_length('spacing');
+ });
this._list.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
this._list.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
this.clone._updateId = this.metaWindow.connect('position-changed',
Lang.bind(this, this._onPositionChanged));
- this.clone._destroyId = this.realWindow.connect('destroy', Lang.bind(this, function() {
+ this.clone._destroyId = this.realWindow.connect('destroy', () => {
// First destroy the clone and then destroy everything
// This will ensure that we never see it in the _disconnectSignals loop
this.clone.destroy();
this.destroy();
- }));
+ });
this._onPositionChanged();
this.actor.connect('button-release-event',
this._draggable.connect('drag-end', Lang.bind(this, this._onDragEnd));
this.inDrag = false;
- let iter = Lang.bind(this, function(win) {
+ let iter = win => {
let actor = win.get_compositor_private();
if (!actor)
win.foreach_transient(iter);
return true;
- });
+ };
this.metaWindow.foreach_transient(iter);
},
clone._updateId = metaDialog.connect('position-changed',
Lang.bind(this, this._updateDialogPosition, clone));
- clone._destroyId = realDialog.connect('destroy', Lang.bind(this, function() {
+ clone._destroyId = realDialog.connect('destroy', () => {
clone.destroy();
- }));
+ });
this.actor.add_child(clone);
},
},
_disconnectSignals() {
- this.actor.get_children().forEach(function(child) {
+ this.actor.get_children().forEach(child => {
let realWindow = child.source;
realWindow.meta_window.disconnect(child._updateId);
let monitor = Main.layoutManager.primaryMonitor;
this.setPorthole(monitor.x, monitor.y, monitor.width, monitor.height);
- let windows = global.get_window_actors().filter(Lang.bind(this, function(actor) {
+ let windows = global.get_window_actors().filter(actor => {
let win = actor.meta_window;
return win.located_on_workspace(metaWorkspace);
- }));
+ });
// Create clones for windows that should be visible in the Overview
this._windows = [];
},
syncStacking(stackIndices) {
- this._windows.sort(function (a, b) { return stackIndices[a.metaWindow.get_stable_sequence()] - stackIndices[b.metaWindow.get_stable_sequence()]; });
+ this._windows.sort((a, b) => {
+ let indexA = stackIndices[a.metaWindow.get_stable_sequence()];
+ let indexB = stackIndices[b.metaWindow.get_stable_sequence()];
+ return indexA - indexB;
+ });
for (let i = 0; i < this._windows.length; i++) {
let clone = this._windows[i];
if (!win) {
// Newly-created windows are added to a workspace before
// the compositor finds out about them...
- let id = Mainloop.idle_add(Lang.bind(this,
- function () {
- if (!this._removed &&
- metaWin.get_compositor_private() &&
- metaWin.get_workspace() == this.metaWorkspace)
- this._doAddWindow(metaWin);
- return GLib.SOURCE_REMOVE;
- }));
+ let id = Mainloop.idle_add(() => {
+ if (!this._removed &&
+ metaWin.get_compositor_private() &&
+ metaWin.get_workspace() == this.metaWorkspace)
+ this._doAddWindow(metaWin);
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(id, '[gnome-shell] this._doAddWindow');
return;
}
_addWindowClone(win) {
let clone = new WindowClone(win);
- clone.connect('selected',
- Lang.bind(this, function(clone, time) {
- this.activate(time);
- }));
- clone.connect('drag-begin',
- Lang.bind(this, function() {
- Main.overview.beginWindowDrag(clone.metaWindow);
- }));
- clone.connect('drag-cancelled',
- Lang.bind(this, function() {
- Main.overview.cancelledWindowDrag(clone.metaWindow);
- }));
- clone.connect('drag-end',
- Lang.bind(this, function() {
- Main.overview.endWindowDrag(clone.metaWindow);
- }));
+ clone.connect('selected', (clone, time) => {
+ this.activate(time);
+ });
+ clone.connect('drag-begin', () => {
+ Main.overview.beginWindowDrag(clone.metaWindow);
+ });
+ clone.connect('drag-cancelled', () => {
+ Main.overview.cancelledWindowDrag(clone.metaWindow);
+ });
+ clone.connect('drag-end', () => {
+ Main.overview.endWindowDrag(clone.metaWindow);
+ });
this._contents.add_actor(clone.actor);
if (this._windows.length == 0)
this._thumbnails = [];
- this.actor.connect('button-press-event', function() { return Clutter.EVENT_STOP; });
+ this.actor.connect('button-press-event', () => Clutter.EVENT_STOP);
this.actor.connect('button-release-event', Lang.bind(this, this._onButtonRelease));
this.actor.connect('touch-event', Lang.bind(this, this._onTouchEvent));
this._settings.connect('changed::dynamic-workspaces',
Lang.bind(this, this._updateSwitcherVisibility));
- Main.layoutManager.connect('monitors-changed', Lang.bind(this, function() {
+ Main.layoutManager.connect('monitors-changed', () => {
this._destroyThumbnails();
if (Main.overview.visible)
this._createThumbnails();
- }));
+ });
},
_updateSwitcherVisibility() {
},
_workspacesChanged() {
- let validThumbnails = this._thumbnails.filter(function(t) {
- return t.state <= ThumbnailState.NORMAL;
- });
+ let validThumbnails =
+ this._thumbnails.filter(t => t.state <= ThumbnailState.NORMAL);
let oldNumWorkspaces = validThumbnails.length;
let newNumWorkspaces = global.screen.n_workspaces;
let active = global.screen.get_active_workspace_index();
return;
// Then slide out any thumbnails that have been destroyed
- this._iterateStateThumbnails(ThumbnailState.REMOVING,
- function(thumbnail) {
- this._setThumbnailState(thumbnail, ThumbnailState.ANIMATING_OUT);
-
- Tweener.addTween(thumbnail,
- { slidePosition: 1,
- time: SLIDE_ANIMATION_TIME,
- transition: 'linear',
- onComplete() {
- this._setThumbnailState(thumbnail, ThumbnailState.ANIMATED_OUT);
- this._queueUpdateStates();
- },
- onCompleteScope: this
- });
- });
+ this._iterateStateThumbnails(ThumbnailState.REMOVING, thumbnail => {
+ this._setThumbnailState(thumbnail, ThumbnailState.ANIMATING_OUT);
+
+ Tweener.addTween(thumbnail,
+ { slidePosition: 1,
+ time: SLIDE_ANIMATION_TIME,
+ transition: 'linear',
+ onComplete: () => {
+ this._setThumbnailState(thumbnail, ThumbnailState.ANIMATED_OUT);
+ this._queueUpdateStates();
+ }
+ });
+ });
// As long as things are sliding out, don't proceed
if (this._stateCounts[ThumbnailState.ANIMATING_OUT] > 0)
return;
// Once that's complete, we can start scaling to the new size and collapse any removed thumbnails
- this._iterateStateThumbnails(ThumbnailState.ANIMATED_OUT,
- function(thumbnail) {
- this.actor.set_skip_paint(thumbnail.actor, true);
- this._setThumbnailState(thumbnail, ThumbnailState.COLLAPSING);
- Tweener.addTween(thumbnail,
- { collapseFraction: 1,
- time: RESCALE_ANIMATION_TIME,
- transition: 'easeOutQuad',
- onComplete() {
- this._stateCounts[thumbnail.state]--;
- thumbnail.state = ThumbnailState.DESTROYED;
-
- let index = this._thumbnails.indexOf(thumbnail);
- this._thumbnails.splice(index, 1);
- thumbnail.destroy();
-
- this._queueUpdateStates();
- },
- onCompleteScope: this
- });
- });
+ this._iterateStateThumbnails(ThumbnailState.ANIMATED_OUT, thumbnail => {
+ this.actor.set_skip_paint(thumbnail.actor, true);
+ this._setThumbnailState(thumbnail, ThumbnailState.COLLAPSING);
+ Tweener.addTween(thumbnail,
+ { collapseFraction: 1,
+ time: RESCALE_ANIMATION_TIME,
+ transition: 'easeOutQuad',
+ onComplete: () => {
+ this._stateCounts[thumbnail.state]--;
+ thumbnail.state = ThumbnailState.DESTROYED;
+
+ let index = this._thumbnails.indexOf(thumbnail);
+ this._thumbnails.splice(index, 1);
+ thumbnail.destroy();
+
+ this._queueUpdateStates();
+ }
+ });
+ });
if (this._pendingScaleUpdate) {
this._tweenScale();
return;
// And then slide in any new thumbnails
- this._iterateStateThumbnails(ThumbnailState.NEW,
- function(thumbnail) {
- this._setThumbnailState(thumbnail, ThumbnailState.ANIMATING_IN);
- Tweener.addTween(thumbnail,
- { slidePosition: 0,
- time: SLIDE_ANIMATION_TIME,
- transition: 'easeOutQuad',
- onComplete() {
- this._setThumbnailState(thumbnail, ThumbnailState.NORMAL);
- },
- onCompleteScope: this
- });
- });
+ this._iterateStateThumbnails(ThumbnailState.NEW, thumbnail => {
+ this._setThumbnailState(thumbnail, ThumbnailState.ANIMATING_IN);
+ Tweener.addTween(thumbnail,
+ { slidePosition: 0,
+ time: SLIDE_ANIMATION_TIME,
+ transition: 'easeOutQuad',
+ onComplete: () => {
+ this._setThumbnailState(thumbnail, ThumbnailState.NORMAL);
+ }
+ });
+ });
},
_queueUpdateStates() {
let y = box.y1;
if (this._dropPlaceholderPos == -1) {
- Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
+ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._dropPlaceholder.hide();
- }));
+ });
}
let childBox = new Clutter.ActorBox();
childBox.y1 = Math.round(y);
childBox.y2 = Math.round(y + placeholderHeight);
this._dropPlaceholder.allocate(childBox, flags);
- Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
+ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._dropPlaceholder.show();
- }));
+ });
y += placeholderHeight + spacing;
}
this._updateWorkspacesId = global.screen.connect('notify::n-workspaces', Lang.bind(this, this._updateWorkspaces));
this._overviewShownId =
- Main.overview.connect('shown',
- Lang.bind(this, function() {
+ Main.overview.connect('shown', () => {
this.actor.set_clip(this._fullGeometry.x, this._fullGeometry.y,
this._fullGeometry.width, this._fullGeometry.height);
- }));
+ });
this._switchWorkspaceNotifyId =
global.window_manager.connect('switch-workspace',
// matter which tween we use, so we pick the first one ...
if (w == 0) {
this._updateVisibility();
- params.onComplete = Lang.bind(this,
- function() {
- this._animating = false;
- this._updateVisibility();
- });
+ params.onComplete = () => {
+ this._animating = false;
+ this._updateVisibility();
+ };
}
Tweener.addTween(workspace.actor, params);
} else {
value: index,
time: WORKSPACE_SWITCH_TIME,
transition: 'easeOutQuad',
- onComplete: Lang.bind(this,
- function() {
- this._animatingScroll = false;
- })
+ onComplete: () => {
+ this._animatingScroll = false;
+ }
});
},
this.actor.connect('parent-set', Lang.bind(this, this._parentSet));
let clickAction = new Clutter.ClickAction();
- clickAction.connect('clicked', Lang.bind(this, function(action) {
+ clickAction.connect('clicked', action => {
// Only switch to the workspace when there's no application
// windows open. The problem is that it's too easy to miss
// an app window and get the wrong one focused.
if ((action.get_button() == 1 || action.get_button() == 0) &&
this._workspacesViews[index].getActiveWorkspace().isEmpty())
Main.overview.hide();
- }));
+ });
Main.overview.addAction(clickAction);
this.actor.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
let panAction = new Clutter.PanAction({ threshold_trigger_edge: Clutter.GestureTriggerEdge.AFTER });
panAction.connect('pan', Lang.bind(this, this._onPan));
- panAction.connect('gesture-begin', Lang.bind(this, function() {
+ panAction.connect('gesture-begin', () => {
if (this._workspacesOnlyOnPrimary) {
let event = Clutter.get_current_event();
if (this._getMonitorIndexForEvent(event) != this._primaryIndex)
for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].startSwipeScroll();
return true;
- }));
- panAction.connect('gesture-cancel', Lang.bind(this, function() {
+ });
+ panAction.connect('gesture-cancel', () => {
clickAction.release();
for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].endSwipeScroll();
- }));
- panAction.connect('gesture-end', Lang.bind(this, function() {
+ });
+ panAction.connect('gesture-end', () => {
clickAction.release();
for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].endSwipeScroll();
- }));
+ });
Main.overview.addAction(panAction);
this.actor.bind_property('mapped', panAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
oldParent.disconnect(this._notifyOpacityId);
this._notifyOpacityId = 0;
- Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
- function() {
- let newParent = this.actor.get_parent();
- if (!newParent)
+ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
+ let newParent = this.actor.get_parent();
+ if (!newParent)
+ return;
+
+ // This is kinda hackish - we want the primary view to
+ // appear as parent of this.actor, though in reality it
+ // is added directly to Main.layoutManager.overviewGroup
+ this._notifyOpacityId = newParent.connect('notify::opacity', () => {
+ let opacity = this.actor.get_parent().opacity;
+ let primaryView = this._getPrimaryView();
+ if (!primaryView)
return;
-
- // This is kinda hackish - we want the primary view to
- // appear as parent of this.actor, though in reality it
- // is added directly to Main.layoutManager.overviewGroup
- this._notifyOpacityId = newParent.connect('notify::opacity',
- Lang.bind(this, function() {
- let opacity = this.actor.get_parent().opacity;
- let primaryView = this._getPrimaryView();
- if (!primaryView)
- return;
- primaryView.actor.opacity = opacity;
- primaryView.actor.visible = opacity != 0;
- }));
- }));
+ primaryView.actor.opacity = opacity;
+ primaryView.actor.visible = opacity != 0;
+ });
+ });
},
// This geometry should always be the fullest geometry
if (useCairo)
obin.style = 'border: 3px solid green;';
else
- obin.connect_after('paint', function(actor) {
+ obin.connect_after('paint', actor => {
Cogl.set_source_color4f(0, 1, 0, 1);
let geom = actor.get_allocation_geometry();
resize_animated(label1);
resize_animated(label2);
- Mainloop.timeout_add(DELAY, Lang.bind(this, function() {
+ Mainloop.timeout_add(DELAY, () => {
log(label1 + label1.get_size());
resize_animated(label1);
resize_animated(label2);
return true;
- }));
+ });
- Mainloop.timeout_add(2 * DELAY, Lang.bind(this, function() {
+ Mainloop.timeout_add(2 * DELAY, () => {
iter += 1;
iter %= shadowStyles.length;
label1.set_style(get_css_style(shadowStyles[iter]));
label2.set_style(get_css_style(shadowStyles[iter]));
label2.set_text(shadowStyles[iter]);
return true;
- }));
+ });
UI.main(stage);
}
Gdk.set_program_class('test-gjsgapp');
let app = new Gtk.Application({ application_id: 'org.gnome.Shell.GtkApplicationTest' });
- app.connect('activate', function() {
+ app.connect('activate', () => {
print ("Activated");
});
let window = null;
- app.connect_after('startup', function(app) {
+ app.connect_after('startup', app => {
app.set_app_menu(menu);
window = new Gtk.ApplicationWindow({ title: "Test Application", application: app });
});
- app.connect('activate', function(app) {
+ app.connect('activate', app => {
window.present();
});
button = new St.Button ({ label: 'Smaller', style_class: 'push-button' });
hbox.add (button);
- button.connect('clicked', function() {
+ button.connect('clicked', () => {
size /= 1.2;
update_size ();
});
button = new St.Button ({ label: 'Bigger', style_class: 'push-button' });
hbox.add (button);
- button.connect('clicked', function() {
+ button.connect('clicked', () => {
size *= 1.2;
update_size ();
});
scrollView.set_policy(Gtk.PolicyType[hpolicy.label], Gtk.PolicyType[vpolicy.label]);
}
- hpolicy.connect('clicked', function() { togglePolicy(hpolicy); });
- vpolicy.connect('clicked', function() { togglePolicy(vpolicy); });
+ hpolicy.connect('clicked', () => { togglePolicy(hpolicy); });
+ vpolicy.connect('clicked', () => { togglePolicy(vpolicy); });
let fadeBox = new St.BoxLayout({ vertical: false });
mainBox.add(fadeBox);
scrollView.style += (button.label == 'Yes' ? 'padding: 10px;' : 'padding: 0;');
}
- paddingButton.connect('clicked', function() { togglePadding(paddingButton); });
+ paddingButton.connect('clicked', () => { togglePadding(paddingButton); });
function toggleBorders(button) {
switch(button.label) {
scrollView.style += (button.label == 'Yes' ? 'border: 2px solid red;' : 'border: 0;');
}
- borderButton.connect('clicked', function() { toggleBorders(borderButton); });
+ borderButton.connect('clicked', () => { toggleBorders(borderButton); });
function toggleFade(button) {
switch(button.label) {
scrollView.set_style_class_name(button.label == 'Yes' ? 'vfade' : '');
}
- vfade.connect('clicked', function() { toggleFade(vfade); });
+ vfade.connect('clicked', () => { toggleFade(vfade); });
toggleFade(vfade);
function toggleOverlay(button) {
scrollView.overlay_scrollbars = (button.label == 'Yes');
}
- overlay.connect('clicked', function() { toggleOverlay(overlay); });
+ overlay.connect('clicked', () => { toggleOverlay(overlay); });
UI.main(stage);
}
let v = new St.ScrollView();
vbox.add(v, { expand: true });
- toggle.connect('notify::checked', function () {
+ toggle.connect('notify::checked', () => {
v.set_policy(toggle.checked ? Gtk.PolicyType.AUTOMATIC
: Gtk.PolicyType.NEVER,
Gtk.PolicyType.AUTOMATIC);
function main(stage) {
stage.show();
- stage.connect('destroy', function() {
+ stage.connect('destroy', () => {
Clutter.main_quit();
});
Clutter.main();